Index: trunk/Ohana/src/dvomerge/src/dvoverify.c
===================================================================
--- trunk/Ohana/src/dvomerge/src/dvoverify.c	(revision 30830)
+++ trunk/Ohana/src/dvomerge/src/dvoverify.c	(revision 31160)
@@ -13,6 +13,5 @@
 # define DEBUG 0
 
-int VERBOSE;
-int CHECKSORTED;
+int VERBOSE = FALSE;
 int NNotSorted = 0;
 
@@ -28,14 +27,22 @@
   // Catalog catalog;
 
-  VERBOSE = FALSE;
+  int CHECKSORTED;
+
   if ((N = get_argument (argc, argv, "-v"))) {
     VERBOSE = TRUE;
     remove_argument (N, &argc, argv);
   }
+  if ((N = get_argument (argc, argv, "-verbose"))) {
+    VERBOSE = TRUE;
+    remove_argument (N, &argc, argv);
+  }
   if ((N = get_argument (argc, argv, "-s"))) {
     CHECKSORTED = TRUE;
     remove_argument (N, &argc, argv);
   }
-
+  if ((N = get_argument (argc, argv, "-sorted"))) {
+    CHECKSORTED = TRUE;
+    remove_argument (N, &argc, argv);
+  }
 
   // restrict to a portion of the sky
@@ -57,6 +64,8 @@
 
   if (argc != 2) {
-    fprintf (stderr, "USAGE: dvoverify (catdir) [-region Rmin Rmax Dmin Dmax] [-v -s]\n\n -v = verbose \n -s = checks if sorted, return error if not\n");
-    fprintf (stderr, "  catdir : database of interest\n");
+    fprintf (stderr, "USAGE: dvoverify (catdir) [-region Rmin Rmax Dmin Dmax] [-v] [-s]\n\n");
+    fprintf (stderr, "  -v : VERBOSE\n");
+    fprintf (stderr, "  -s : checks if sorted, return error if not\n");
+    fprintf (stderr, "  (catdir) : database of interest\n");
     exit (2);
   }
@@ -96,5 +105,4 @@
   for (i = 0; i < inlist[0].Nregions; i++) {
     if (!inlist[0].regions[i][0].table) continue;
-    if ((NNotSorted > 0) && CHECKSORTED) continue;
     if (i % 1000 == 0) fprintf (stderr, ".");
 
@@ -116,4 +124,10 @@
     if (!CheckCatalogIndexes(catdir, inlist[0].filename[i], inlist[0].regions[i])){
       Nbad ++;
+    }
+
+    // exit immediately if any file are unsorted and we require sorted tables
+    if (CHECKSORTED && NNotSorted) {
+      fprintf (stderr, "ERROR: files are not sorted\n");
+      exit (1);
     }
   }
@@ -123,10 +137,9 @@
     exit (1);
   }
-  if ((NNotSorted > 0) && CHECKSORTED) {
-    fprintf (stderr, "ERROR: files are not sorted\n");
-     exit (1);
-  }
 
   fprintf (stderr, "SUCCESS: no files are bad\n");
+  if (NNotSorted) {
+    fprintf (stderr, "NOTE: %d files are not sorted\n", NNotSorted);
+  }
   exit (0);
 }
