diff --git a/Inst_eddies/Tests/short_tests.json b/Inst_eddies/Tests/short_tests.json
index d5706dbcce2ca128b13ebdfdf15ec6253f087fd9..9004d3b3de0ffa8b99ee89c9bf6072eb69b0f59e 100644
--- a/Inst_eddies/Tests/short_tests.json
+++ b/Inst_eddies/Tests/short_tests.json
@@ -292,13 +292,15 @@
 	],
 	"input": "f\n"
     },
-    "Extraction_eddies_region_1": {
+    "Extraction_eddies_region_1":
+    {
 	"create_file": [
             "config_nml.txt",
             "&config_nml min_amp = 0./\n"
 	],
 	"input": "&dates_nml date = 20454/\n",
-	"commands": [
+	"commands":
+	[
             [
 		"mkdir",
 		"-p",
diff --git a/Inst_eddies/inst_eddies.f90 b/Inst_eddies/inst_eddies.f90
index 552cac62bb1ab0163aebadca4cb9c02d27f43129..a01f0c55bf33578148a08463d2a7abb54192a897 100644
--- a/Inst_eddies/inst_eddies.f90
+++ b/Inst_eddies/inst_eddies.f90
@@ -1,6 +1,6 @@
 program inst_eddies
 
-  ! The current directory should contain directory SHPC.
+  ! The current directory at run-time should contain directory SHPC.
 
   use, intrinsic:: ieee_arithmetic, only: IEEE_SUPPORT_DATATYPE, &
        ieee_support_nan
diff --git a/Inst_eddies/set_all_contours.f90 b/Inst_eddies/set_all_contours.f90
index b746376125affe56043ae643bd2b3bb37f520701..f4f205e453425bf34d59a97065d2d056346f7d2d 100644
--- a/Inst_eddies/set_all_contours.f90
+++ b/Inst_eddies/set_all_contours.f90
@@ -101,7 +101,7 @@ contains
 
     ! Done sorting
 
-    do l = 1, s%number_extr
+    loop_extr: do l = 1, s%number_extr
        i = sorted_extr(l)
 
        associate (e => s%list(i))
@@ -161,7 +161,7 @@ contains
                  cont_list(:n_cont))
          end if
        end associate
-    end do
+    end do loop_extr
 
   end subroutine set_all_contours
 
diff --git a/Inst_eddies/set_max_speed.f90 b/Inst_eddies/set_max_speed.f90
index eea012289e5e94a4af3a0025ff6f828e052ceb8d..cb5bd92f30b33b9c2cdd339a8158f97bde06e949 100644
--- a/Inst_eddies/set_max_speed.f90
+++ b/Inst_eddies/set_max_speed.f90
@@ -8,9 +8,9 @@ contains
 
     ! This procedure defines the components speed_cont and max_speed
     ! of argument e. On return, e%speed_cont may be a null ssh contour
-    ! and e%max_speed may be set to missing_speed. However,
-    ! e%max_speed is never NaN. On return, if e%speed_cont is not a
-    ! null ssh contour then e%max_speed is the speed on e%speed_cont.
+    ! and e%max_speed may be set to missing_speed. e%max_speed is
+    ! never NaN. On return, if e%speed_cont is not a null ssh contour
+    ! then e%max_speed is the speed on e%speed_cont.
 
     ! The length of the interval of longitudes of the domain, step(1)
     ! * (size(ssh, 1) - 1), should be < 180 degrees, so that the
@@ -37,10 +37,10 @@ contains
     real, intent(in):: step(:) ! (2) longitude and latitude steps, in rad
 
     type(ssh_contour), intent(in):: cont_list(:) ! (n_cont)
-    ! Contour list. The outermost contour is element with subscript
-    ! n_cont. The contours are in monotonic order of ssh. If n_cont >=
-    ! 2, cont_list(:n_cont - 1)%area is missing and cont_list(:n_cont
-    ! - 1) is not oriented. n_cont >= 1.
+    ! Contour list. n_cont >= 1. The outermost contour is element with
+    ! subscript n_cont. The contours are in monotonic order of ssh. If
+    ! n_cont >= 2, cont_list(:n_cont - 1)%area are missing and
+    ! cont_list(:n_cont - 1) are not oriented.
 
     ! Local:
     real speed(size(cont_list)) ! (n_cont) speed on the contour
diff --git a/Trajectories/cost_function.py b/Trajectories/cost_function.py
index 6c4e827a51c4cde11b11b8353bfd224fe6b8ed53..823f13a29d5ffa54bc78466b1ba71acafb141080 100755
--- a/Trajectories/cost_function.py
+++ b/Trajectories/cost_function.py
@@ -30,7 +30,9 @@ def calculate_radii_rossby(properties):
     """Compute average on some instantaneous eddies of Rossby number and
     radius of maximum speed contour. The required properties for each
     eddy are position, radius and speed. "properties" is a list of
-    dictionaries. Each dictionary in the list contains the three properties.
+    dictionaries. Each dictionary in the list contains the three
+    properties. If the speed is not defined for any eddy then the
+    returned value of avg_Rossby is 0.
 
     """
 
@@ -181,10 +183,9 @@ for edge in g.edges():
     source_node = edge.source()
     target_node = edge.target()
 
-    lat_for_conv = (g.vp.pos_last[source_node][1] +
-                    g.vp.pos_first[target_node][1]) / 2
+    lat_for_conv = math.radians((g.vp.pos_last[source_node][1] +
+                                 g.vp.pos_first[target_node][1]) / 2)
     # (latitude needed for conversion of degrees to kilometers)
-    lat_for_conv = math.radians(lat_for_conv) # need to convert to radians
 
     # Because of the wrapping issue (360° wrapping incorrectly to 0°),
     # we check for that here:
@@ -203,7 +204,6 @@ for edge in g.edges():
             - g.vp.first_av_ros[target_node]
     else:
         # At least one of the rossbies is invalid.
-        # Delta_Ro = delta_ro_mean
         Delta_Ro = 0
 
     second_term = ((Delta_Ro - delta_ro_mean)/delta_ro_std)**2