diff --git a/Analysis/plot_snapshot.py b/Analysis/plot_snapshot.py
index 8229998bc6559637eb0ffad34faf3e956052f7c8..a2d295a97fe038019d666217dda9833229fe612c 100755
--- a/Analysis/plot_snapshot.py
+++ b/Analysis/plot_snapshot.py
@@ -28,45 +28,21 @@ import cartopy.crs as ccrs
 from os import path
 from cartopy.mpl import geoaxes
 
-def snapshot(k, shp_tr_dir, window = None, *, dashed = False, light = False,
+def snapshot(k, k1, ishape_last, reader_extr, reader_outer, reader_m_s = None,
+             window = None, *, dashed = False, light = False,
              new_figure = False, src_crs = ccrs.PlateCarree(),
              projection = ccrs.PlateCarree()):
     """Plots extrema, outermost contours and max-speed contours.
 
-    shp_tr_dir: containing the three shapefiles.
     dashed: boolean."""
     
-    reader_extr = shapefile.Reader(path.join(shp_tr_dir, "extremum"))
-    reader_outer = shapefile.Reader(path.join(shp_tr_dir, "outermost_contour"))
-    k1 = reader_extr.record(0).date_index
-    fname = path.join(shp_tr_dir, "ishape_last.txt")
-
-    try:
-        ishape_last = np.loadtxt(fname, dtype = int)
-
-        if k is None:
-            print("No date provided, plotting first date:", k1)
-            k = k1
-    except OSError:
-        print("Could not read", fname)
-        print("We will use all the shapes.")
-        ishape_last = [len(reader_extr) - 1]
-        if k is not None: print("Ignoring value of argument k")
-        k = k1
-
     if k == k1:
         ishape_first = 0
-    else:
-        # {k > k1}
+    elif k > k1:
         ishape_first = ishape_last[k - k1 - 1] + 1
-
-    try:
-        reader_m_s = shapefile.Reader(path.join(shp_tr_dir,
-                                                "max_speed_contour"))
-    except shapefile.ShapefileException:
-        print("Shapefile max_speed_contour not found. "
-              "Max-speed contours will not be plotted.")
-        reader_m_s = None
+    else:
+        print("bad k value")
+        return
 
     if new_figure:
         plt.figure()
@@ -226,9 +202,39 @@ if __name__ == "__main__":
                 marker = "+", color = "gray", linestyle = "None")
 
     if args.window is None: plot_grid_bb(args.shp_tr_dir, ax)
-    plt.suptitle(f"k = {args.k}")
-    snapshot(args.k, args.shp_tr_dir, args.window, dashed = args.dashed,
-             light = args.light)
+    reader_extr = shapefile.Reader(path.join(args.shp_tr_dir, "extremum"))
+    reader_outer = shapefile.Reader(path.join(args.shp_tr_dir,
+                                              "outermost_contour"))
+
+    try:
+        reader_m_s = shapefile.Reader(path.join(args.shp_tr_dir,
+                                                "max_speed_contour"))
+    except shapefile.ShapefileException:
+        print("Shapefile max_speed_contour not found. "
+              "Max-speed contours will not be plotted.")
+        reader_m_s = None
+
+    k1 = reader_extr.record(0).date_index
+    fname = path.join(args.shp_tr_dir, "ishape_last.txt")
+
+    try:
+        ishape_last = np.loadtxt(fname, dtype = int)
+
+        if args.k is None:
+            print("No option k, plotting first date:", k1)
+            k = k1
+        else:
+            k = args.k
+    except OSError:
+        print("Could not read", fname)
+        print("We will use all the shapes.")
+        ishape_last = [len(reader_extr) - 1]
+        if args.k is not None: print("Ignoring value of option k")
+        k = k1
+
+    plt.suptitle(f"k = {k}")
+    snapshot(k, k1, ishape_last, reader_extr, reader_outer, reader_m_s,
+             args.window, dashed = args.dashed, light = args.light)
 
     if args.velocity:
         with netCDF4.Dataset("uv.nc") as f: