diff --git a/Trajectories/Tests/tests.json b/Trajectories/Tests/tests.json
index 7beead31de88c61c3edcf6adde1025aeb5b7e218..4474af688112e3821a3d8cfe5e13b71227d6b0f2 100644
--- a/Trajectories/Tests/tests.json
+++ b/Trajectories/Tests/tests.json
@@ -89,13 +89,14 @@
             "$tests_old_dir/Greece_cost_function/segments_cost_functions.graphml"
 	]
     },
-    "Draw_segments": {
-	"command": [
+    "Draw_segments":
+    {
+	"command":
+	[
             "$src_dir/Trajectories/draw_segments.py",
             "$my_data_dir/Eurec4A/Eurec4A_graph_anti/segments_cost_functions.gt",
             "segments.gv",
-            "-t",
-            "$my_data_dir/Eurec4A/Eurec4A_graph_anti/traj_segm.json"
+            "-t", "$my_data_dir/Eurec4A/Eurec4A_graph_anti/traj_segm.json"
 	]
     },
     "Plot_traj": {
diff --git a/Trajectories/cost_function.py b/Trajectories/cost_function.py
index 3bb03ce95dd0b464b2351bb4f14aa1cf3a7f3c44..8b3b428ed7224c50f9f04ac4f9da9cfdd235eb8a 100755
--- a/Trajectories/cost_function.py
+++ b/Trajectories/cost_function.py
@@ -91,9 +91,9 @@ parser = argparse.ArgumentParser()
 parser.add_argument("SHPC_dir")
 parser.add_argument("orientation", choices = ["Anticyclones", "Cyclones"])
 parser.add_argument("input_segments", help = "input graph of segments without "
-                    "cost functions, suffix .gt (graph-tool) or .graphml")
+                    "cost, suffix .gt (graph-tool) or .graphml")
 parser.add_argument("output_segments", help = "output graph of segments with "
-                    "cost functions, suffix .gt (graph-tool) or .graphml")
+                    "cost, suffix .gt (graph-tool) or .graphml")
 args = parser.parse_args()
 with open("e_overestim.txt") as f: e_overestim = int(f.read())
 
diff --git a/Trajectories/trajectories.py b/Trajectories/trajectories.py
index f9537903dea145fe80cf2a9ca9c1f5a28312848e..582e374ef9989c6466454eb541f2d99a6aad24fe 100755
--- a/Trajectories/trajectories.py
+++ b/Trajectories/trajectories.py
@@ -25,18 +25,18 @@ traj_prop = g.new_vertex_property('int', val = - 1)
 # does not belong yet to any trajectory. The trajectory index is also
 # the index in lists traj_segm and expanded_traj.
 
-all_cost = g.get_edges([g.edge_properties.cost_function])
-# numpy array with dtype float64
-
-# Array of indices that sort on cost:
-ind_cost = np.argsort(all_cost[:, 2])
-
 ind_traj = - 1 # initialize index of trajectory
 traj_segm = [] # an element of traj_segm is a trajectory, represented
                # by a list of segments
 expanded_traj = [] # an element of expanded_traj is a trajectory,
                    # represented by a list of instantaneous eddies
 
+all_cost = g.get_edges([g.edge_properties.cost_function])
+# numpy array with dtype float64
+
+# Array of indices that sort on cost:
+ind_cost = np.argsort(all_cost[:, 2])
+
 # Loop over edges in ascending order of cost:
 for i in ind_cost:
     source = all_cost[i, 0]