Index: trunk/Ohana/src/opihi/dvo/cmd.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/cmd.c	(revision 12332)
+++ trunk/Ohana/src/opihi/dvo/cmd.c	(revision 14401)
@@ -3,5 +3,4 @@
 int cmd (int argc, char **argv) { /* really need to think about upper limits & how to represent them */
   
-  char *RegionName, *RegionList;
   double *M1, *M3;
   int i, j, m, i1, i3, N1, N3, N;
@@ -12,4 +11,5 @@
   Catalog catalog;
   SkyList *skylist;
+  SkyRegionSelection *selection;
   Vector *xvec, *yvec;
 
@@ -18,7 +18,6 @@
   catalog.secfilt = NULL;
   catalog.measure = NULL;
-  RegionName = NULL;
-  RegionList = NULL;
   skylist = NULL;
+  selection = NULL;
 
   /* load photcode information */
@@ -27,5 +26,5 @@
 
   /* interpret command-line options */
-  if (!SetRegionSelection (&argc, argv, &RegionName, &RegionList)) goto escape;
+  if ((selection = SetRegionSelection (&argc, argv)) == NULL) goto escape;
   if (!SetPhotSelections (&argc, argv, 3)) goto usage;
 
@@ -46,5 +45,5 @@
 
   /* load region corresponding to selection above */
-  if ((skylist = SelectRegions (RegionName, RegionList)) == NULL) goto escape;
+  if ((skylist = SelectRegions (selection)) == NULL) goto escape;
 
   /* init vectors to save data */
@@ -107,6 +106,8 @@
     dvo_catalog_free (&catalog);
   }
-  SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL)));
+
   xvec[0].Nelements = yvec[0].Nelements = Npts;
+  SkyListFree (skylist);
+  FreeSkyRegionSelection (selection);
   return (TRUE);
 
@@ -116,8 +117,7 @@
 
 escape:
-  SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL)));
   dvo_catalog_free (&catalog);
-  if (RegionName != NULL) free (RegionName);
-  if (RegionList != NULL) free (RegionList);
+  SkyListFree (skylist);
+  FreeSkyRegionSelection (selection);
   return (FALSE);
 }
