diff --git a/beat/web/experiments/static/experiments/js/panels.js b/beat/web/experiments/static/experiments/js/panels.js
index 19b38c2eac08af42f5854613e3cece12685ea5d5..9e0f1fd5b5a17d0f2194a78fa3b57ee4866da4b5 100644
--- a/beat/web/experiments/static/experiments/js/panels.js
+++ b/beat/web/experiments/static/experiments/js/panels.js
@@ -262,10 +262,10 @@ beat.experiments.panels.Settings.prototype._initializeAlgorithmComponents = func
 
   function _custom_cmp(a, b)
   {
-    var dist_a = Math.pow(a.representation.row - origin.row, 2) + Math.pow(a.representation.col - origin.col, 2);
-    var dist_b = Math.pow(b.representation.row - origin.row, 2) + Math.pow(b.representation.col - origin.col, 2);
+    var dist_a = Math.pow(a.representation.col - origin.col, 2) + 0.1*Math.abs(a.representation.row - origin.row);
+    var dist_b = Math.pow(b.representation.col - origin.col, 2) + 0.1*Math.abs(b.representation.row - origin.row);
 
-    return dist_a > dist_b;
+    return dist_a - dist_b;
   }
 
   var components_sorted_by_position = [].concat(components);