diff --git a/ConfigureCompilerFlags.cmake b/ConfigureCompilerFlags.cmake
index 39783b3165f6e1176108e2080254cef35de0e782..eb55359a04e0b4db9bc7f68c58f8836e64f31849 100644
--- a/ConfigureCompilerFlags.cmake
+++ b/ConfigureCompilerFlags.cmake
@@ -49,6 +49,5 @@ elseif(CMAKE_Fortran_COMPILER_ID MATCHES Intel)
     " -debug full -debug-parameters all -ftrapuv")
 elseif(CMAKE_Fortran_COMPILER_ID MATCHES NAG)
   string(APPEND CMAKE_Fortran_FLAGS " -f2003")
-
   string(APPEND CMAKE_Fortran_FLAGS_DEBUG " -C=all -gline -nan -strict95")
 endif()
diff --git a/Tests/test_write_overlap.f90 b/Tests/test_write_overlap.f90
index bdab05bed92c614767b9ef041b43bbc753699f0c..2f6e4bba3b3e0914776ab4cba150323e4983ae1a 100644
--- a/Tests/test_write_overlap.f90
+++ b/Tests/test_write_overlap.f90
@@ -7,7 +7,7 @@ program test_write_overlap
   use shapelib, only: shpfileobject, shpclose
 
   use init_shapefiles_m, only: init_shapefiles
-  use write_overlap_m, only: write_overlap
+  use write_overlap_m, only: write_overlap, init_interpolated_eddy
 
   implicit none
 
@@ -39,6 +39,7 @@ program test_write_overlap
   write(unit_edgelist, fmt = *) "k1 i1 k2 i2 weight"
   
   call init_shapefiles(hshp_extremum, hshp_outermost, hshp_max_speed)
+  call init_interpolated_eddy
   call write_overlap(hshp_extremum, hshp_outermost, hshp_max_speed, &
        unit_edgelist, k, delta, i1 = 1, i2 = 1, &
        i_interp = [(1, j_interp = 1, delta - 1)], cyclone = .true., &
diff --git a/overlap.f90 b/overlap.f90
index b1e1f438d697718c5ebab60a53e673e476166b95..ee2edf081ede9e4fe4aa4706f8d228aec2a9ce89 100644
--- a/overlap.f90
+++ b/overlap.f90
@@ -63,8 +63,8 @@ contains
 
     !-----------------------------------------------------------------------
 
-    do i1 = 1, flow(j - delta)%number_vis_extr
-       if (flow(j - delta)%list_vis(i1)%valid) then
+    loop_i1: do i1 = 1, flow(j - delta)%number_vis_extr
+       test_valid: if (flow(j - delta)%list_vis(i1)%valid) then
           ! Define the geographical window around each eddy extremum:
 
           llc = flow(j - delta)%ind_extr(:, i1) - dist_lim
@@ -130,8 +130,8 @@ contains
                 end if
              end if
           end DO
-       end if
-    end do
+       end if test_valid
+    end do loop_i1
 
   end subroutine overlap
   
diff --git a/write_overlap.f90 b/write_overlap.f90
index 0098afc097462b204997c98681b5e8b9ceff76e9..4b62eb732e2a8bce08ad1b77073c0cc9fd724abb 100644
--- a/write_overlap.f90
+++ b/write_overlap.f90
@@ -1,6 +1,11 @@
 module write_overlap_m
 
+  use derived_types, only: eddy
+
   implicit none
+  
+  private eddy
+  type(eddy), private, save:: e
 
 contains
 
@@ -14,7 +19,6 @@ contains
     use nr_util, only: twopi
     use shapelib, only: shpfileobject
 
-    use derived_types, only: eddy, null_ssh_contour, missing_speed
     use write_eddy_m, only: write_eddy
 
     TYPE(shpfileobject), intent(in):: hshp_extremum ! shapefile extremum
@@ -41,7 +45,6 @@ contains
     real, intent(in):: w
 
     ! Local:
-    type(eddy) e
     integer i_pred, j_interp, k_interp
     real w_interp
     real coord_extr_2_local(2)
@@ -49,14 +52,6 @@ contains
     !-------------------------------------------------------------------
 
     if (delta >= 2) then
-       ! Set some null components of the interpolated eddy:
-       e%out_cont = null_ssh_contour()
-       e%speed_cont = null_ssh_contour()
-       e%max_speed = missing_speed
-       e%valid = .false.
-       e%interpolated = .true.
-       e%radius4 = 0
-
        ! Prepare interpolation:
 
        e%cyclone = cyclone
@@ -88,4 +83,23 @@ contains
 
   end subroutine write_overlap
 
+  !**************************************************************************
+
+  subroutine init_interpolated_eddy
+
+    ! Set some null components of the interpolated eddy:
+
+    use derived_types, only: null_ssh_contour, missing_speed
+
+    !-----------------------------------------------------------------------
+    
+    e%out_cont = null_ssh_contour()
+    e%speed_cont = null_ssh_contour()
+    e%max_speed = missing_speed
+    e%valid = .false.
+    e%interpolated = .true.
+    e%radius4 = 0
+
+  end subroutine init_interpolated_eddy
+
 end module write_overlap_m