Index: trunk/Ohana/src/relastro/include/relastro.h
===================================================================
--- trunk/Ohana/src/relastro/include/relastro.h	(revision 38062)
+++ trunk/Ohana/src/relastro/include/relastro.h	(revision 38441)
@@ -539,5 +539,4 @@
 int hpm_objects (SkyRegion *region, Catalog *catalog);
 
-int strextend (char *input, char *format,...);
 int launch_region_hosts (RegionHostTable *regionHosts);
 
@@ -591,6 +590,4 @@
 float getColorBlue (off_t meas, int cat);
 float getColorRed (off_t meas, int cat);
-
-int strextend (char *input, char *format,...);
 
 int areImagesLoaded ();
Index: trunk/Ohana/src/relastro/src/BrightCatalog.c
===================================================================
--- trunk/Ohana/src/relastro/src/BrightCatalog.c	(revision 38062)
+++ trunk/Ohana/src/relastro/src/BrightCatalog.c	(revision 38441)
@@ -172,5 +172,5 @@
     GET_COLUMN(Nmeasure,       "NMEASURE",       short);
     GET_COLUMN(Nmissing,       "NMISSING",       short);
-    GET_COLUMN(Nextend,        "NEXTEND",        short);
+    GET_COLUMN(Ngalphot,      "NGALPHOT",      short);
     GET_COLUMN(measureOffset,  "OFF_MEASURE",    int);
     GET_COLUMN(missingOffset,  "OFF_MISSING",    int);
@@ -208,5 +208,5 @@
       average[i].Nmeasure        = Nmeasure[i]        ;
       average[i].Nmissing        = Nmissing[i]        ;
-      average[i].Nextend         = Nextend[i]         ;
+      average[i].Ngalphot       = Ngalphot[i]         ;
       average[i].measureOffset   = measureOffset[i]   ; 
       average[i].missingOffset   = missingOffset[i]   ; 
@@ -241,5 +241,5 @@
     free (Nmeasure);
     free (Nmissing);
-    free (Nextend);
+    free (Ngalphot);
     free (measureOffset);
     free (missingOffset);
@@ -502,5 +502,5 @@
     gfits_define_bintable_column (&theader, "I", "NMEASURE",       "number of psf measurements", 	                  "", 1.0, 0.0);
     gfits_define_bintable_column (&theader, "I", "NMISSING",       "number of missings", 	          	          "", 1.0, 0.0);
-    gfits_define_bintable_column (&theader, "I", "NEXTEND",        "number of extended measurements", 	                  "", 1.0, 0.0);
+    gfits_define_bintable_column (&theader, "I", "NGALPHOT",      "number of galaxy shape measurements",                 "", 1.0, 0.0);
     gfits_define_bintable_column (&theader, "J", "OFF_MEASURE",    "offset to first psf measurement", 	 	          "", 1.0, 0.0);
     gfits_define_bintable_column (&theader, "J", "OFF_MISSING",    "offset to first missing obs", 	         	  "", 1.0, 0.0);
@@ -537,5 +537,5 @@
     short    *Nmeasure      ; ALLOCATE (Nmeasure      , short   , catalog->Naverage);
     short    *Nmissing      ; ALLOCATE (Nmissing      , short   , catalog->Naverage);
-    short    *Nextend       ; ALLOCATE (Nextend       , short   , catalog->Naverage);
+    short    *Ngalphot     ; ALLOCATE (Ngalphot     , short   , catalog->Naverage);
     int      *measureOffset ; ALLOCATE (measureOffset , int     , catalog->Naverage);
     int      *missingOffset ; ALLOCATE (missingOffset , int     , catalog->Naverage);
@@ -571,5 +571,5 @@
       Nmeasure[i]        = average[i].Nmeasure        ;
       Nmissing[i]        = average[i].Nmissing        ;
-      Nextend[i]         = average[i].Nextend         ;
+      Ngalphot[i]       = average[i].Ngalphot       ;
       measureOffset[i]   = average[i].measureOffset   ; 
       missingOffset[i]   = average[i].missingOffset   ; 
@@ -604,5 +604,5 @@
     gfits_set_bintable_column (&theader, &ftable, "NMEASURE",       Nmeasure,        catalog->Naverage);
     gfits_set_bintable_column (&theader, &ftable, "NMISSING",       Nmissing,        catalog->Naverage);
-    gfits_set_bintable_column (&theader, &ftable, "NEXTEND",        Nextend,         catalog->Naverage);
+    gfits_set_bintable_column (&theader, &ftable, "NGALPHOT",      Ngalphot,       catalog->Naverage);
     gfits_set_bintable_column (&theader, &ftable, "OFF_MEASURE",    measureOffset,   catalog->Naverage);
     gfits_set_bintable_column (&theader, &ftable, "OFF_MISSING",    missingOffset,   catalog->Naverage);
@@ -635,5 +635,5 @@
     free (Nmeasure);
     free (Nmissing);
-    free (Nextend);
+    free (Ngalphot);
     free (measureOffset);
     free (missingOffset);
Index: trunk/Ohana/src/relastro/src/ImageTable.c
===================================================================
--- trunk/Ohana/src/relastro/src/ImageTable.c	(revision 38062)
+++ trunk/Ohana/src/relastro/src/ImageTable.c	(revision 38441)
@@ -7,4 +7,5 @@
   FITS_DB db;
 
+  gfits_db_init (&db);
   db.mode   = dvo_catalog_catmode (CATMODE);
   db.format = dvo_catalog_catformat (CATFORMAT);
@@ -27,5 +28,5 @@
   // convert database table to internal structure (binary to Image)
   // 'image' points to the same memory as db->ftable->buffer
-  Image *image = gfits_table_get_Image (&db.ftable, &Nimage, &db.swapped);
+  Image *image = gfits_table_get_Image (&db.ftable, &Nimage, &db.scaledValue, &db.nativeOrder);
   if (!image) {
     Shutdown ("ERROR: failed to read images");
@@ -42,4 +43,5 @@
 
   // setup image table format and lock 
+  gfits_db_init (&db);
   db.mode   = dvo_catalog_catmode (CATMODE);
   db.format = dvo_catalog_catformat (CATFORMAT);
Index: trunk/Ohana/src/relastro/src/UpdateObjectOffsets.c
===================================================================
--- trunk/Ohana/src/relastro/src/UpdateObjectOffsets.c	(revision 38062)
+++ trunk/Ohana/src/relastro/src/UpdateObjectOffsets.c	(revision 38441)
@@ -34,5 +34,5 @@
     catalog.catformat = dvo_catalog_catformat (CATFORMAT);    // set the default catformat from config data
     catalog.catmode   = dvo_catalog_catmode (CATMODE);        // set the default catmode from config data
-    catalog.catflags  = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;
+    catalog.catflags  = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT;
     catalog.Nsecfilt  = GetPhotcodeNsecfilt ();
 
@@ -41,5 +41,5 @@
       exit (1);
     }
-    if (!catalog.Naves_disk) {
+    if (!catalog.Naverage_disk) {
       if (VERBOSE2) fprintf (stderr, "no data in %s, skipping\n", catalog.filename);
       dvo_catalog_unlock (&catalog);
@@ -102,5 +102,5 @@
 
   int Ngroups;
-  HostTableGroup *groups = HostTableGroups (table, &Ngroups);
+  HostTableGroup *groups = HostTableGroupsUniqueMachines (table, &Ngroups);
   // split the table into Ngroups, each with a unique set of machines (this avoids overloading the remote host machines)
 
@@ -152,49 +152,49 @@
     // MaxDensityUse, MaxDensityValue
 
-    char command[1024];
-    snprintf (command, 1024, "relastro_client -update-offsets -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -statmode %s -minerror %f", 
+    char *command = NULL;
+    strextend (&command, "relastro_client -update-offsets -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -statmode %s -minerror %f", 
 	      group->hosts[i][0].hostID, CATDIR, group->hosts[i][0].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, STATMODE, MIN_ERROR);
 
-    if (FIT_MODE == FIT_PM_ONLY)  	 strextend (command, "-pm");
-    if (FIT_MODE == FIT_PAR_ONLY) 	 strextend (command, "-par");
-    if (FIT_MODE == FIT_PM_AND_PAR)      strextend (command, "-pmpar");
-
-    if (VERBOSE)       strextend (command, "-v");
-    if (VERBOSE2)      strextend (command, "-vv");
-    if (RESET)         strextend (command, "-reset");
-    if (UPDATE)        strextend (command, "-update");
-
-    if (RESET_BAD_IMAGES) strextend (command, "-reset-bad-images");
-
-    if (ImagSelect)    strextend (command, "-instmag %f %f", ImagMin, ImagMax);
-    if (MaxDensityUse) strextend (command, "-max-density %f", MaxDensityValue);
-    
-    if (USE_BASIC_CHECK) strextend (command, "-basic-image-search");
-    if (FlagOutlier)     strextend (command, "-clip %d", CLIP_THRESH);
-    if (ExcludeBogus)    strextend (command, "-exclude-bogus %f", ExcludeBogusRadius);
-    
-    if (USE_FIXED_PIXCOORDS) strextend (command, "-D USE_FIXED_PIXCOORDS 1"); 
-
-    if (PHOTCODE_KEEP_LIST) strextend (command, "+photcode %s", PHOTCODE_KEEP_LIST);
-    if (PHOTCODE_SKIP_LIST) strextend (command, "-photcode %s", PHOTCODE_SKIP_LIST);
-    if (PhotFlagSelect)     strextend (command, "+photflags"); 
-    if (PhotFlagBad)        strextend (command, "+photflagbad %d", PhotFlagBad);
-    if (PhotFlagPoor)       strextend (command, "+photflagpoor %d", PhotFlagPoor);
+    if (FIT_MODE == FIT_PM_ONLY)  	 strextend (&command, "-pm");
+    if (FIT_MODE == FIT_PAR_ONLY) 	 strextend (&command, "-par");
+    if (FIT_MODE == FIT_PM_AND_PAR)      strextend (&command, "-pmpar");
+
+    if (VERBOSE)       strextend (&command, "-v");
+    if (VERBOSE2)      strextend (&command, "-vv");
+    if (RESET)         strextend (&command, "-reset");
+    if (UPDATE)        strextend (&command, "-update");
+
+    if (RESET_BAD_IMAGES) strextend (&command, "-reset-bad-images");
+
+    if (ImagSelect)    strextend (&command, "-instmag %f %f", ImagMin, ImagMax);
+    if (MaxDensityUse) strextend (&command, "-max-density %f", MaxDensityValue);
+    
+    if (USE_BASIC_CHECK) strextend (&command, "-basic-image-search");
+    if (FlagOutlier)     strextend (&command, "-clip %d", CLIP_THRESH);
+    if (ExcludeBogus)    strextend (&command, "-exclude-bogus %f", ExcludeBogusRadius);
+    
+    if (USE_FIXED_PIXCOORDS) strextend (&command, "-D USE_FIXED_PIXCOORDS 1"); 
+
+    if (PHOTCODE_KEEP_LIST) strextend (&command, "+photcode %s", PHOTCODE_KEEP_LIST);
+    if (PHOTCODE_SKIP_LIST) strextend (&command, "-photcode %s", PHOTCODE_SKIP_LIST);
+    if (PhotFlagSelect)     strextend (&command, "+photflags"); 
+    if (PhotFlagBad)        strextend (&command, "+photflagbad %d", PhotFlagBad);
+    if (PhotFlagPoor)       strextend (&command, "+photflagpoor %d", PhotFlagPoor);
     // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values
 
     if (DCR_BLUE_COLOR_POS && DCR_BLUE_COLOR_NEG) {
-      strextend (command, "-dcr-blue-color %s %s", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG); 
+      strextend (&command, "-dcr-blue-color %s %s", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG); 
     }
     if (DCR_RED_COLOR_POS && DCR_RED_COLOR_NEG) {
-      strextend (command, "-dcr-red-color %s %s", DCR_RED_COLOR_POS, DCR_RED_COLOR_NEG); 
-    }
-
-    if (MinBadQF > 0.0)        strextend (command, "-min-bad-psfqf %f", MinBadQF); 
-    if (MaxMeanOffset != 10.0) strextend (command, "-max-mean-offset  %f", MaxMeanOffset);
+      strextend (&command, "-dcr-red-color %s %s", DCR_RED_COLOR_POS, DCR_RED_COLOR_NEG); 
+    }
+
+    if (MinBadQF > 0.0)        strextend (&command, "-min-bad-psfqf %f", MinBadQF); 
+    if (MaxMeanOffset != 10.0) strextend (&command, "-max-mean-offset  %f", MaxMeanOffset);
 
     if (TimeSelect) { 
       char *tstart = ohana_sec_to_date (TSTART);
       char *tstop  = ohana_sec_to_date (TSTOP);
-      strextend (command, "-time %s %s", tstart, tstop); 
+      strextend (&command, "-time %s %s", tstart, tstop); 
       free (tstart);
       free (tstop);
@@ -270,49 +270,49 @@
     // MaxDensityUse, MaxDensityValue
 
-    char command[1024];
-    snprintf (command, 1024, "relastro_client -update-offsets -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -statmode %s -minerror %f", 
+    char *command = NULL;
+    strextend (&command, "relastro_client -update-offsets -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -statmode %s -minerror %f", 
 	      table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, STATMODE, MIN_ERROR);
 
-    if (FIT_MODE == FIT_PM_ONLY)  	 strextend (command, "-pm");
-    if (FIT_MODE == FIT_PAR_ONLY) 	 strextend (command, "-par");
-    if (FIT_MODE == FIT_PM_AND_PAR)      strextend (command, "-pmpar");
-
-    if (VERBOSE)       strextend (command, "-v");
-    if (VERBOSE2)      strextend (command, "-vv");
-    if (RESET)         strextend (command, "-reset");
-    if (UPDATE)        strextend (command, "-update");
-
-    if (RESET_BAD_IMAGES) strextend (command, "-reset-bad-images");
-
-    if (ImagSelect)    strextend (command, "-instmag %f %f", ImagMin, ImagMax);
-    if (MaxDensityUse) strextend (command, "-max-density %f", MaxDensityValue);
-    
-    if (USE_BASIC_CHECK) strextend (command, "-basic-image-search");
-    if (FlagOutlier)     strextend (command, "-clip %d", CLIP_THRESH);
-    if (ExcludeBogus)    strextend (command, "-exclude-bogus %f", ExcludeBogusRadius);
-    
-    if (USE_FIXED_PIXCOORDS) strextend (command, "-D USE_FIXED_PIXCOORDS 1"); 
-
-    if (PHOTCODE_KEEP_LIST) strextend (command, "+photcode %s", PHOTCODE_KEEP_LIST);
-    if (PHOTCODE_SKIP_LIST) strextend (command, "-photcode %s", PHOTCODE_SKIP_LIST);
-    if (PhotFlagSelect)     strextend (command, "+photflags"); 
-    if (PhotFlagBad)        strextend (command, "+photflagbad %d", PhotFlagBad);
-    if (PhotFlagPoor)       strextend (command, "+photflagpoor %d", PhotFlagPoor);
+    if (FIT_MODE == FIT_PM_ONLY)  	 strextend (&command, "-pm");
+    if (FIT_MODE == FIT_PAR_ONLY) 	 strextend (&command, "-par");
+    if (FIT_MODE == FIT_PM_AND_PAR)      strextend (&command, "-pmpar");
+
+    if (VERBOSE)       strextend (&command, "-v");
+    if (VERBOSE2)      strextend (&command, "-vv");
+    if (RESET)         strextend (&command, "-reset");
+    if (UPDATE)        strextend (&command, "-update");
+
+    if (RESET_BAD_IMAGES) strextend (&command, "-reset-bad-images");
+
+    if (ImagSelect)    strextend (&command, "-instmag %f %f", ImagMin, ImagMax);
+    if (MaxDensityUse) strextend (&command, "-max-density %f", MaxDensityValue);
+    
+    if (USE_BASIC_CHECK) strextend (&command, "-basic-image-search");
+    if (FlagOutlier)     strextend (&command, "-clip %d", CLIP_THRESH);
+    if (ExcludeBogus)    strextend (&command, "-exclude-bogus %f", ExcludeBogusRadius);
+    
+    if (USE_FIXED_PIXCOORDS) strextend (&command, "-D USE_FIXED_PIXCOORDS 1"); 
+
+    if (PHOTCODE_KEEP_LIST) strextend (&command, "+photcode %s", PHOTCODE_KEEP_LIST);
+    if (PHOTCODE_SKIP_LIST) strextend (&command, "-photcode %s", PHOTCODE_SKIP_LIST);
+    if (PhotFlagSelect)     strextend (&command, "+photflags"); 
+    if (PhotFlagBad)        strextend (&command, "+photflagbad %d", PhotFlagBad);
+    if (PhotFlagPoor)       strextend (&command, "+photflagpoor %d", PhotFlagPoor);
     // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values
 
     if (DCR_BLUE_COLOR_POS && DCR_BLUE_COLOR_NEG) {
-      strextend (command, "-dcr-blue-color %s %s", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG); 
+      strextend (&command, "-dcr-blue-color %s %s", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG); 
     }
     if (DCR_RED_COLOR_POS && DCR_RED_COLOR_NEG) {
-      strextend (command, "-dcr-red-color %s %s", DCR_RED_COLOR_POS, DCR_RED_COLOR_NEG); 
-    }
-
-    if (MinBadQF > 0.0)        strextend (command, "-min-bad-psfqf %f", MinBadQF); 
-    if (MaxMeanOffset != 10.0) strextend (command, "-max-mean-offset  %f", MaxMeanOffset);
+      strextend (&command, "-dcr-red-color %s %s", DCR_RED_COLOR_POS, DCR_RED_COLOR_NEG); 
+    }
+
+    if (MinBadQF > 0.0)        strextend (&command, "-min-bad-psfqf %f", MinBadQF); 
+    if (MaxMeanOffset != 10.0) strextend (&command, "-max-mean-offset  %f", MaxMeanOffset);
 
     if (TimeSelect) { 
       char *tstart = ohana_sec_to_date (TSTART);
       char *tstop  = ohana_sec_to_date (TSTOP);
-      strextend (command, "-time %s %s", tstart, tstop); 
+      strextend (&command, "-time %s %s", tstart, tstop); 
       free (tstart);
       free (tstop);
Index: trunk/Ohana/src/relastro/src/args.c
===================================================================
--- trunk/Ohana/src/relastro/src/args.c	(revision 38062)
+++ trunk/Ohana/src/relastro/src/args.c	(revision 38441)
@@ -959,14 +959,2 @@
 }
 
-int strextend (char *input, char *format,...) {
-
-  char tmpextra[1024], tmpline[1024];
-  va_list argp;
-
-  va_start (argp, format);
-  vsnprintf (tmpextra, 1024, format, argp);
-  snprintf (tmpline, 1024, "%s %s", input, tmpextra);
-  strcpy (input, tmpline);
-
-  return TRUE;
-}
Index: trunk/Ohana/src/relastro/src/assign_images.c
===================================================================
--- trunk/Ohana/src/relastro/src/assign_images.c	(revision 38062)
+++ trunk/Ohana/src/relastro/src/assign_images.c	(revision 38441)
@@ -11,5 +11,5 @@
   // convert database table to internal structure (binary to Image)
   // 'image' points to the same memory as db->ftable->buffer
-  Image *image = gfits_table_get_Image (&db[0].ftable, &Nimage, &db[0].swapped);
+  Image *image = gfits_table_get_Image (&db[0].ftable, &Nimage, &db[0].scaledValue, &db[0].nativeOrder);
   if (!image) {
       fprintf (stderr, "ERROR: failed to read images\n");
Index: trunk/Ohana/src/relastro/src/bcatalog.c
===================================================================
--- trunk/Ohana/src/relastro/src/bcatalog.c	(revision 38062)
+++ trunk/Ohana/src/relastro/src/bcatalog.c	(revision 38441)
@@ -521,5 +521,5 @@
   subcatalog[0].Nmeasure = Nmeasure;
   subcatalog[0].Nsecfilt = oldcatalog[0].Nsecfilt;
-  subcatalog[0].Nsecf_mem = Naverage * oldcatalog[0].Nsecfilt;
+  subcatalog[0].Nsecfilt_mem = Naverage * oldcatalog[0].Nsecfilt;
 
   return (TRUE);
@@ -628,5 +628,5 @@
   subcatalog[0].Nmeasure = Nmeasure;
   subcatalog[0].Nsecfilt = oldcatalog[0].Nsecfilt;
-  subcatalog[0].Nsecf_mem = Naverage * oldcatalog[0].Nsecfilt;
+  subcatalog[0].Nsecfilt_mem = Naverage * oldcatalog[0].Nsecfilt;
 
   return (TRUE);
@@ -722,5 +722,5 @@
   subcatalog[0].Nmeasure = Nmeasure;
   subcatalog[0].Nsecfilt = catalog[0].Nsecfilt;
-  subcatalog[0].Nsecf_mem = Naverage * catalog[0].Nsecfilt;
+  subcatalog[0].Nsecfilt_mem = Naverage * catalog[0].Nsecfilt;
 
   return (TRUE);
Index: trunk/Ohana/src/relastro/src/high_speed_catalogs.c
===================================================================
--- trunk/Ohana/src/relastro/src/high_speed_catalogs.c	(revision 38062)
+++ trunk/Ohana/src/relastro/src/high_speed_catalogs.c	(revision 38441)
@@ -31,5 +31,5 @@
     catalog.catformat = dvo_catalog_catformat (CATFORMAT);    // set the default catformat from config data
     catalog.catmode   = dvo_catalog_catmode (CATMODE);        // set the default catmode from config data
-    catalog.catflags  = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;
+    catalog.catflags  = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT;
     catalog.Nsecfilt  = GetPhotcodeNsecfilt ();
 
@@ -38,5 +38,5 @@
       exit (1);
     }
-    if (!catalog.Naves_disk) {
+    if (!catalog.Naverage_disk) {
       if (VERBOSE2) fprintf (stderr, "no data in %s, skipping\n", catalog.filename);
       dvo_catalog_unlock (&catalog);
@@ -147,6 +147,6 @@
     }
 
-    char command[1024];
-    snprintf (command, 1024, "relastro_client -high-speed %s %s %f %s -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f", 
+    char *command = NULL;
+    strextend (&command, "relastro_client -high-speed %s %s %f %s -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f", 
 	      PHOTCODE_A_LIST, PHOTCODE_B_LIST, RADIUS, outputDir, table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax);
 
@@ -154,41 +154,36 @@
 
     // options / arguments that can affect relastro_client -high-speed
-    char tmpline[1024];
-    if (FIT_MODE == FIT_PM_ONLY)  	 { snprintf (tmpline, 1024, "%s -pm",    command);           	strcpy (command, tmpline); }
-    if (FIT_MODE == FIT_PAR_ONLY) 	 { snprintf (tmpline, 1024, "%s -par",   command);           	strcpy (command, tmpline); }
-    if (FIT_MODE == FIT_PM_AND_PAR)      { snprintf (tmpline, 1024, "%s -pmpar", command);           	strcpy (command, tmpline); }
-
-    if (VERBOSE)       { snprintf (tmpline, 1024, "%s -v",              command);                    	strcpy (command, tmpline); }
-    if (VERBOSE2)      { snprintf (tmpline, 1024, "%s -vv",             command); 		     	strcpy (command, tmpline); }
-    if (RESET)         { snprintf (tmpline, 1024, "%s -reset",          command); 		     	strcpy (command, tmpline); }
-    if (ImagSelect)    { snprintf (tmpline, 1024, "%s -instmag %f %f",  command, ImagMin, ImagMax);  	strcpy (command, tmpline); }
-    if (MaxDensityUse) { snprintf (tmpline, 1024, "%s -max-density %f", command, MaxDensityValue);   	strcpy (command, tmpline); }
+    if (FIT_MODE == FIT_PM_ONLY)  	 { strextend (&command, "-pm"); }
+    if (FIT_MODE == FIT_PAR_ONLY) 	 { strextend (&command, "-par"); }
+    if (FIT_MODE == FIT_PM_AND_PAR)      { strextend (&command, "-pmpar"); }
+
+    if (VERBOSE)       { strextend (&command, "-v"); }
+    if (VERBOSE2)      { strextend (&command, "-vv"); }
+    if (RESET)         { strextend (&command, "-reset"); }
+    if (ImagSelect)    { strextend (&command, "-instmag %f %f", ImagMin, ImagMax); }
+    if (MaxDensityUse) { strextend (&command, "-max-density %f", MaxDensityValue); }
     
-    if (USE_BASIC_CHECK) { snprintf (tmpline, 1024, "%s -basic-image-search", command);              	strcpy (command, tmpline); }
-
-    if (FlagOutlier)   { snprintf (tmpline, 1024, "%s -clip %d",        command, CLIP_THRESH);       	strcpy (command, tmpline); }
-    
-    if (USE_FIXED_PIXCOORDS) { snprintf (tmpline, 1024, "%s -D USE_FIXED_PIXCOORDS 1", command);     strcpy (command, tmpline); }
-
-    if (PHOTCODE_KEEP_LIST) { snprintf (tmpline, 1024, "%s +photcode %s", command, PHOTCODE_KEEP_LIST); strcpy (command, tmpline); }
-    if (PHOTCODE_SKIP_LIST) { snprintf (tmpline, 1024, "%s -photcode %s", command, PHOTCODE_SKIP_LIST); strcpy (command, tmpline); }
-    if (PhotFlagSelect)    { snprintf (tmpline, 1024, "%s +photflags",   command);                      strcpy (command, tmpline); }
-    if (PhotFlagBad)       { snprintf (tmpline, 1024, "%s +photflagbad %d", command, PhotFlagBad);      strcpy (command, tmpline); }
-    if (PhotFlagPoor)      { snprintf (tmpline, 1024, "%s +photflagpoor %d", command, PhotFlagPoor);    strcpy (command, tmpline); }
+    if (USE_BASIC_CHECK)     { strextend (&command, "-basic-image-search"); }
+    if (FlagOutlier)         { strextend (&command, "-clip %d", CLIP_THRESH); }
+    if (USE_FIXED_PIXCOORDS) { strextend (&command, "-D USE_FIXED_PIXCOORDS 1"); }
+    if (PHOTCODE_KEEP_LIST)  { strextend (&command, "+photcode %s", PHOTCODE_KEEP_LIST); }
+    if (PHOTCODE_SKIP_LIST)  { strextend (&command, "-photcode %s", PHOTCODE_SKIP_LIST); }
+    if (PhotFlagSelect)      { strextend (&command, "+photflags"); }
+    if (PhotFlagBad)         { strextend (&command, "+photflagbad %d", PhotFlagBad); }
+    if (PhotFlagPoor)        { strextend (&command, "+photflagpoor %d", PhotFlagPoor); }
     // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values
 
-    if (MinBadQF > 0.0)    { snprintf (tmpline, 1024, "%s -min-bad-psfqf %f",        command, MinBadQF);      strcpy (command, tmpline); }
-    if (MaxMeanOffset != 10.0) { snprintf (tmpline, 1024, "%s -max-mean-offset  %f", command, MaxMeanOffset); strcpy (command, tmpline); }
-
-    if (WHERE_A[0]) { snprintf (tmpline, 1024, "%s -D WHERE_A \"%s\"", command, WHERE_A);               strcpy (command, tmpline); }
-    if (WHERE_B[0]) { snprintf (tmpline, 1024, "%s -D WHERE_B \"%s\"", command, WHERE_B);               strcpy (command, tmpline); }
+    if (MinBadQF > 0.0)        { strextend (&command, "-min-bad-psfqf %f", MinBadQF); }
+    if (MaxMeanOffset != 10.0) { strextend (&command, "-max-mean-offset  %f", MaxMeanOffset); }
+
+    if (WHERE_A[0]) { strextend (&command, "-D WHERE_A \"%s\"", WHERE_A); }
+    if (WHERE_B[0]) { strextend (&command, "-D WHERE_B \"%s\"", WHERE_B); }
 
     if (TimeSelect) { 
       char *tstart = ohana_sec_to_date (TSTART);
       char *tstop  = ohana_sec_to_date (TSTOP);
-      snprintf (tmpline, 1024, "%s -time %s %s", command, tstart, tstop); 
+      strextend (&command, "-time %s %s", tstart, tstop); 
       free (tstart);
       free (tstop);
-      strcpy (command, tmpline); 
     }
 
Index: trunk/Ohana/src/relastro/src/high_speed_objects.c
===================================================================
--- trunk/Ohana/src/relastro/src/high_speed_objects.c	(revision 38062)
+++ trunk/Ohana/src/relastro/src/high_speed_objects.c	(revision 38441)
@@ -32,5 +32,5 @@
   catalogOut.filename = filename; // based on the input name, need to keep everything below the catdir portion
   catalogOut.Nsecfilt = Nsecfilt;
-  catalogOut.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF; // load all data
+  catalogOut.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT; // load all data
   
   catalogOut.catformat = dvo_catalog_catformat (CATFORMAT);  // set the default catformat from config data
@@ -263,5 +263,5 @@
   catalogOut.Nmeasure=Nmatchmeas;
   catalogOut.Nsecfilt=Nsecfilt;
-  catalogOut.Nsecf_mem=Nmatch*Nsecfilt;
+  catalogOut.Nsecfilt_mem=Nmatch*Nsecfilt;
 
   populate_tiny_values (&catalogOut, DVO_TV_MEASURE);
Index: trunk/Ohana/src/relastro/src/hpm_catalogs.c
===================================================================
--- trunk/Ohana/src/relastro/src/hpm_catalogs.c	(revision 38062)
+++ trunk/Ohana/src/relastro/src/hpm_catalogs.c	(revision 38441)
@@ -29,5 +29,5 @@
     catalog.catformat = dvo_catalog_catformat (CATFORMAT);    // set the default catformat from config data
     catalog.catmode   = dvo_catalog_catmode (CATMODE);        // set the default catmode from config data
-    catalog.catflags  = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;
+    catalog.catflags  = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT;
     catalog.Nsecfilt  = GetPhotcodeNsecfilt ();
 
@@ -36,5 +36,5 @@
       exit (1);
     }
-    if (!catalog.Naves_disk) {
+    if (!catalog.Naverage_disk) {
       if (VERBOSE2) fprintf (stderr, "no data in %s, skipping\n", catalog.filename);
       dvo_catalog_unlock (&catalog);
@@ -145,6 +145,6 @@
     }
 
-    char command[1024];
-    snprintf (command, 1024, "relastro_client -hpm %f %s -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f", 
+    char *command = NULL;
+    strextend (&command, "relastro_client -hpm %f %s -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f", 
 	      RADIUS, outputDir, table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax);
 
@@ -152,38 +152,33 @@
 
     // options / arguments that can affect relastro_client -high-speed
-    char tmpline[1024];
-    if (FIT_MODE == FIT_PM_ONLY)  	 { snprintf (tmpline, 1024, "%s -pm",    command);           	strcpy (command, tmpline); }
-    if (FIT_MODE == FIT_PAR_ONLY) 	 { snprintf (tmpline, 1024, "%s -par",   command);           	strcpy (command, tmpline); }
-    if (FIT_MODE == FIT_PM_AND_PAR)      { snprintf (tmpline, 1024, "%s -pmpar", command);           	strcpy (command, tmpline); }
-
-    if (VERBOSE)       { snprintf (tmpline, 1024, "%s -v",              command);                    	strcpy (command, tmpline); }
-    if (VERBOSE2)      { snprintf (tmpline, 1024, "%s -vv",             command); 		     	strcpy (command, tmpline); }
-    if (RESET)         { snprintf (tmpline, 1024, "%s -reset",          command); 		     	strcpy (command, tmpline); }
-    if (ImagSelect)    { snprintf (tmpline, 1024, "%s -instmag %f %f",  command, ImagMin, ImagMax);  	strcpy (command, tmpline); }
-    if (MaxDensityUse) { snprintf (tmpline, 1024, "%s -max-density %f", command, MaxDensityValue);   	strcpy (command, tmpline); }
+    if (FIT_MODE == FIT_PM_ONLY)  	 { strextend (&command, "-pm"); }
+    if (FIT_MODE == FIT_PAR_ONLY) 	 { strextend (&command, "-par"); }
+    if (FIT_MODE == FIT_PM_AND_PAR)      { strextend (&command, "-pmpar"); }
+
+    if (VERBOSE)       { strextend (&command, "-v"); }
+    if (VERBOSE2)      { strextend (&command, "-vv"); }
+    if (RESET)         { strextend (&command, "-reset"); }
+    if (ImagSelect)    { strextend (&command, "-instmag %f %f", ImagMin, ImagMax); }
+    if (MaxDensityUse) { strextend (&command, "-max-density %f", MaxDensityValue); }
     
-    if (USE_BASIC_CHECK) { snprintf (tmpline, 1024, "%s -basic-image-search", command);              	strcpy (command, tmpline); }
-
-    if (FlagOutlier)   { snprintf (tmpline, 1024, "%s -clip %d",        command, CLIP_THRESH);       	strcpy (command, tmpline); }
-    
-    if (USE_FIXED_PIXCOORDS) { snprintf (tmpline, 1024, "%s -D USE_FIXED_PIXCOORDS 1", command);     strcpy (command, tmpline); }
-
-    if (PHOTCODE_KEEP_LIST) { snprintf (tmpline, 1024, "%s +photcode %s", command, PHOTCODE_KEEP_LIST); strcpy (command, tmpline); }
-    if (PHOTCODE_SKIP_LIST) { snprintf (tmpline, 1024, "%s -photcode %s", command, PHOTCODE_SKIP_LIST); strcpy (command, tmpline); }
-    if (PhotFlagSelect)    { snprintf (tmpline, 1024, "%s +photflags",   command);                      strcpy (command, tmpline); }
-    if (PhotFlagBad)       { snprintf (tmpline, 1024, "%s +photflagbad %d", command, PhotFlagBad);      strcpy (command, tmpline); }
-    if (PhotFlagPoor)      { snprintf (tmpline, 1024, "%s +photflagpoor %d", command, PhotFlagPoor);    strcpy (command, tmpline); }
+    if (USE_BASIC_CHECK)     { strextend (&command, "-basic-image-search"); }
+    if (FlagOutlier)         { strextend (&command, "-clip %d", CLIP_THRESH); }
+    if (USE_FIXED_PIXCOORDS) { strextend (&command, "-D USE_FIXED_PIXCOORDS 1"); }
+    if (PHOTCODE_KEEP_LIST)  { strextend (&command, "+photcode %s", PHOTCODE_KEEP_LIST); }
+    if (PHOTCODE_SKIP_LIST)  { strextend (&command, "-photcode %s", PHOTCODE_SKIP_LIST); }
+    if (PhotFlagSelect)      { strextend (&command, "+photflags"); }
+    if (PhotFlagBad)         { strextend (&command, "+photflagbad %d", PhotFlagBad); }
+    if (PhotFlagPoor)        { strextend (&command, "+photflagpoor %d", PhotFlagPoor); }
     // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values
 
-    if (MinBadQF > 0.0)    { snprintf (tmpline, 1024, "%s -min-bad-psfqf %f",        command, MinBadQF);      strcpy (command, tmpline); }
-    if (MaxMeanOffset != 10.0) { snprintf (tmpline, 1024, "%s -max-mean-offset  %f", command, MaxMeanOffset); strcpy (command, tmpline); }
+    if (MinBadQF > 0.0)        { strextend (&command, "-min-bad-psfqf %f", MinBadQF); }
+    if (MaxMeanOffset != 10.0) { strextend (&command, "-max-mean-offset  %f", MaxMeanOffset); }
 
     if (TimeSelect) { 
       char *tstart = ohana_sec_to_date (TSTART);
       char *tstop  = ohana_sec_to_date (TSTOP);
-      snprintf (tmpline, 1024, "%s -time %s %s", command, tstart, tstop); 
+      strextend (&command, "-time %s %s", tstart, tstop); 
       free (tstart);
       free (tstop);
-      strcpy (command, tmpline); 
     }
 
Index: trunk/Ohana/src/relastro/src/hpm_objects.c
===================================================================
--- trunk/Ohana/src/relastro/src/hpm_objects.c	(revision 38062)
+++ trunk/Ohana/src/relastro/src/hpm_objects.c	(revision 38441)
@@ -33,5 +33,5 @@
   catalogOut.filename = filename;
   catalogOut.Nsecfilt = Nsecfilt;
-  catalogOut.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF; // load all data
+  catalogOut.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT; // load all data
   
   catalogOut.catformat = dvo_catalog_catformat (CATFORMAT);  // set the default catformat from config data
@@ -279,5 +279,5 @@
   }
   catalogOut.Nsecfilt = Nsecfilt;
-  catalogOut.Nsecf_mem = Nsecfilt * catalogOut.Naverage;
+  catalogOut.Nsecfilt_mem = Nsecfilt * catalogOut.Naverage;
 
   populate_tiny_values (&catalogOut, DVO_TV_MEASURE);
Index: trunk/Ohana/src/relastro/src/launch_region_hosts.c
===================================================================
--- trunk/Ohana/src/relastro/src/launch_region_hosts.c	(revision 38062)
+++ trunk/Ohana/src/relastro/src/launch_region_hosts.c	(revision 38441)
@@ -77,24 +77,24 @@
     }
 
-    char command[1024];
-    snprintf (command, 1024, "relastro -parallel-images %s", filename);
-    strextend (command, "-region-hosts %s", REGION_FILE);
-    strextend (command, "-region-hostID %d", host->hostID);
-    strextend (command, "-D CATDIR %s", CATDIR);
-    strextend (command, "-region %f %f %f %f", host->RminCat, host->RmaxCat, host->DminCat, host->DmaxCat);
-    strextend (command, "-statmode %s", STATMODE);
-    strextend (command, "-minerror %f", MIN_ERROR);
-    strextend (command, "-nloop %d", NLOOP);
-    strextend (command, "-threads %d", NTHREADS);
+    char *command = NULL;
+    strextend (&command, "relastro -parallel-images %s", filename);
+    strextend (&command, "-region-hosts %s", REGION_FILE);
+    strextend (&command, "-region-hostID %d", host->hostID);
+    strextend (&command, "-D CATDIR %s", CATDIR);
+    strextend (&command, "-region %f %f %f %f", host->RminCat, host->RmaxCat, host->DminCat, host->DmaxCat);
+    strextend (&command, "-statmode %s", STATMODE);
+    strextend (&command, "-minerror %f", MIN_ERROR);
+    strextend (&command, "-nloop %d", NLOOP);
+    strextend (&command, "-threads %d", NTHREADS);
 
     switch (FIT_TARGET) {
       case TARGET_SIMPLE:
-	strextend (command, "-update-simple");
+	strextend (&command, "-update-simple");
 	break;
       case TARGET_CHIPS:
-	strextend (command, "-update-chips");
+	strextend (&command, "-update-chips");
 	break;
       case TARGET_MOSAICS:
-	strextend (command, "-update-mosaics");
+	strextend (&command, "-update-mosaics");
 	break;
       case TARGET_NONE:
@@ -102,54 +102,54 @@
     }
 
-    if (VERBOSE)       	    strextend (command, "-v");
-    if (VERBOSE2)      	    strextend (command, "-vv");
-    if (RESET)         	    strextend (command, "-reset");
-    if (UPDATE)        	    strextend (command, "-update");
-    if (PARALLEL)      	    strextend (command, "-parallel");
-    if (PARALLEL_MANUAL)    strextend (command, "-parallel-manual");
-    if (PARALLEL_SERIAL)    strextend (command, "-parallel-serial");
-    if (PHOTCODE_KEEP_LIST) strextend (command, "+photcode %s", PHOTCODE_KEEP_LIST); 
-    if (PHOTCODE_SKIP_LIST) strextend (command, "-photcode %s", PHOTCODE_SKIP_LIST);
-    if (PHOTCODE_RESET_LIST) strextend (command, "-reset-to-photcode %s", PHOTCODE_RESET_LIST);
+    if (VERBOSE)       	    strextend (&command, "-v");
+    if (VERBOSE2)      	    strextend (&command, "-vv");
+    if (RESET)         	    strextend (&command, "-reset");
+    if (UPDATE)        	    strextend (&command, "-update");
+    if (PARALLEL)      	    strextend (&command, "-parallel");
+    if (PARALLEL_MANUAL)    strextend (&command, "-parallel-manual");
+    if (PARALLEL_SERIAL)    strextend (&command, "-parallel-serial");
+    if (PHOTCODE_KEEP_LIST) strextend (&command, "+photcode %s", PHOTCODE_KEEP_LIST); 
+    if (PHOTCODE_SKIP_LIST) strextend (&command, "-photcode %s", PHOTCODE_SKIP_LIST);
+    if (PHOTCODE_RESET_LIST) strextend (&command, "-reset-to-photcode %s", PHOTCODE_RESET_LIST);
 
-    if (MaxDensityUse) 	    strextend (command, "-max-density %f", MaxDensityValue);
-    if (ImagSelect)         strextend (command, "-instmag %f %f", ImagMin, ImagMax);
-    if (ExcludeBogus)       strextend (command, "-exclude-bogus %f", ExcludeBogusRadius);
+    if (MaxDensityUse) 	    strextend (&command, "-max-density %f", MaxDensityValue);
+    if (ImagSelect)         strextend (&command, "-instmag %f %f", ImagMin, ImagMax);
+    if (ExcludeBogus)       strextend (&command, "-exclude-bogus %f", ExcludeBogusRadius);
 
     if (DCR_BLUE_COLOR_POS && DCR_BLUE_COLOR_NEG) {
-      strextend (command, "-dcr-blue-color %s %s", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG); 
+      strextend (&command, "-dcr-blue-color %s %s", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG); 
     }
     if (DCR_RED_COLOR_POS && DCR_RED_COLOR_NEG) {
-      strextend (command, "-dcr-red-color %s %s", DCR_RED_COLOR_POS, DCR_RED_COLOR_NEG); 
+      strextend (&command, "-dcr-red-color %s %s", DCR_RED_COLOR_POS, DCR_RED_COLOR_NEG); 
     }
 
-    if (PhotFlagSelect)     strextend (command, "+photflags"); 
-    if (PhotFlagBad)        strextend (command, "+photflagbad %d", PhotFlagBad); 
-    if (PhotFlagPoor)       strextend (command, "+photflagpoor %d", PhotFlagPoor); 
+    if (PhotFlagSelect)     strextend (&command, "+photflags"); 
+    if (PhotFlagBad)        strextend (&command, "+photflagbad %d", PhotFlagBad); 
+    if (PhotFlagPoor)       strextend (&command, "+photflagpoor %d", PhotFlagPoor); 
 
-    if (CHIPMAP)            strextend (command, "-chipmap %d", CHIPMAP); 
-    if (RESET_IMAGES)       strextend (command, "-reset-images"); 
+    if (CHIPMAP)            strextend (&command, "-chipmap %d", CHIPMAP); 
+    if (RESET_IMAGES)       strextend (&command, "-reset-images"); 
 
-    if (MinBadQF > 0.0)        strextend (command, "-min-bad-psfqf %f", MinBadQF);
-    if (MaxMeanOffset != 10.0) strextend (command, "-max-mean-offset  %f", MaxMeanOffset);
+    if (MinBadQF > 0.0)        strextend (&command, "-min-bad-psfqf %f", MinBadQF);
+    if (MaxMeanOffset != 10.0) strextend (&command, "-max-mean-offset  %f", MaxMeanOffset);
 
-    strextend (command, "-D RELASTRO_SRC_MEAS_TOOFEW %d", SRC_MEAS_TOOFEW);
-    strextend (command, "-D RELASTRO_SIGMA_LIM %f", SIGMA_LIM);
-    strextend (command, "-D RELASTRO_DPOS_MAX %f", DPOS_MAX);
-    strextend (command, "-D ADDSTAR_RADIUS %f", ADDSTAR_RADIUS);
+    strextend (&command, "-D RELASTRO_SRC_MEAS_TOOFEW %d", SRC_MEAS_TOOFEW);
+    strextend (&command, "-D RELASTRO_SIGMA_LIM %f", SIGMA_LIM);
+    strextend (&command, "-D RELASTRO_DPOS_MAX %f", DPOS_MAX);
+    strextend (&command, "-D ADDSTAR_RADIUS %f", ADDSTAR_RADIUS);
 
-    strextend (command, "-D USE_GALAXY_MODEL %d", USE_GALAXY_MODEL);
+    strextend (&command, "-D USE_GALAXY_MODEL %d", USE_GALAXY_MODEL);
 
-    strextend (command, "-D USE_ICRF_CORRECT %d", USE_ICRF_CORRECT);
-    strextend (command, "-D USE_ICRF_LOCAL %d",   USE_ICRF_LOCAL);
-    strextend (command, "-D USE_ICRF_SHFIT %d",   USE_ICRF_SHFIT);
-    strextend (command, "-D USE_ICRF_POLE %d",    USE_ICRF_POLE);
+    strextend (&command, "-D USE_ICRF_CORRECT %d", USE_ICRF_CORRECT);
+    strextend (&command, "-D USE_ICRF_LOCAL %d",   USE_ICRF_LOCAL);
+    strextend (&command, "-D USE_ICRF_SHFIT %d",   USE_ICRF_SHFIT);
+    strextend (&command, "-D USE_ICRF_POLE %d",    USE_ICRF_POLE);
 
-    if (USE_FIXED_PIXCOORDS) strextend (command, "-D USE_FIXED_PIXCOORDS 1");
+    if (USE_FIXED_PIXCOORDS) strextend (&command, "-D USE_FIXED_PIXCOORDS 1");
 
     if (TimeSelect) { 
       char *tstart = ohana_sec_to_date (TSTART);
       char *tstop  = ohana_sec_to_date (TSTOP);
-      strextend (command, "-time %s %s", tstart, tstop); 
+      strextend (&command, "-time %s %s", tstart, tstop); 
       free (tstart);
       free (tstop);
Index: trunk/Ohana/src/relastro/src/load_catalogs.c
===================================================================
--- trunk/Ohana/src/relastro/src/load_catalogs.c	(revision 38062)
+++ trunk/Ohana/src/relastro/src/load_catalogs.c	(revision 38441)
@@ -40,5 +40,5 @@
     pcatalog->catformat = dvo_catalog_catformat (CATFORMAT);    // set the default catformat from config data
     pcatalog->catmode   = dvo_catalog_catmode (CATMODE);        // set the default catmode from config data
-    pcatalog->catflags  = LOAD_AVES | LOAD_MEAS | LOAD_SECF; // don't need to load all data at this point
+    pcatalog->catflags  = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_SECFILT; // don't need to load all data at this point
     pcatalog->Nsecfilt  = GetPhotcodeNsecfilt ();
 
@@ -48,5 +48,5 @@
       exit (1);
     }
-    if (!pcatalog[0].Naves_disk) {
+    if (!pcatalog[0].Naverage_disk) {
       if (VERBOSE2) fprintf (stderr, "no data in %s, skipping\n", pcatalog[0].filename);
       dvo_catalog_unlock (pcatalog);
@@ -160,36 +160,36 @@
     // MaxDensityUse, MaxDensityValue
 
-    char command[1024];
-    snprintf (command, 1024, "relastro_client -load-objects %s -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -statmode %s -minerror %f -D RELASTRO_SIGMA_LIM %f", 
+    char *command = NULL;
+    strextend (&command, "relastro_client -load-objects %s -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -statmode %s -minerror %f -D RELASTRO_SIGMA_LIM %f", 
 	      table->hosts[i].results, table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, STATMODE, MIN_ERROR, SIGMA_LIM);
 
-    if (FIT_MODE == FIT_PM_ONLY)  	 strextend (command, "-pm");
-    if (FIT_MODE == FIT_PAR_ONLY) 	 strextend (command, "-par");
-    if (FIT_MODE == FIT_PM_AND_PAR)      strextend (command, "-pmpar");
-
-    if (VERBOSE)       strextend (command, "-v");
-    if (VERBOSE2)      strextend (command, "-vv");
-    if (RESET)         strextend (command, "-reset");
-    if (ImagSelect)    strextend (command, "-instmag %f %f", ImagMin, ImagMax);
-    if (MaxDensityUse) strextend (command, "-max-density %f", MaxDensityValue);
-    if (FlagOutlier)   strextend (command, "-clip %d", CLIP_THRESH);
-    if (ExcludeBogus)  strextend (command, "-exclude-bogus %f", ExcludeBogusRadius);
-
-    if (USE_ICRF_CORRECT) strextend (command, "-D USE_ICRF_CORRECT %d", USE_ICRF_CORRECT);
-    if (USE_GALAXY_MODEL) strextend (command, "-D USE_GALAXY_MODEL %d", USE_GALAXY_MODEL);
+    if (FIT_MODE == FIT_PM_ONLY)  	 strextend (&command, "-pm");
+    if (FIT_MODE == FIT_PAR_ONLY) 	 strextend (&command, "-par");
+    if (FIT_MODE == FIT_PM_AND_PAR)      strextend (&command, "-pmpar");
+
+    if (VERBOSE)       strextend (&command, "-v");
+    if (VERBOSE2)      strextend (&command, "-vv");
+    if (RESET)         strextend (&command, "-reset");
+    if (ImagSelect)    strextend (&command, "-instmag %f %f", ImagMin, ImagMax);
+    if (MaxDensityUse) strextend (&command, "-max-density %f", MaxDensityValue);
+    if (FlagOutlier)   strextend (&command, "-clip %d", CLIP_THRESH);
+    if (ExcludeBogus)  strextend (&command, "-exclude-bogus %f", ExcludeBogusRadius);
+
+    if (USE_ICRF_CORRECT) strextend (&command, "-D USE_ICRF_CORRECT %d", USE_ICRF_CORRECT);
+    if (USE_GALAXY_MODEL) strextend (&command, "-D USE_GALAXY_MODEL %d", USE_GALAXY_MODEL);
     
     if (DCR_BLUE_COLOR_POS && DCR_BLUE_COLOR_NEG) {
-      strextend (command, "-dcr-blue-color %s %s", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG); 
+      strextend (&command, "-dcr-blue-color %s %s", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG); 
     }
     if (DCR_RED_COLOR_POS && DCR_RED_COLOR_NEG) {
-      strextend (command, "-dcr-red-color %s %s", DCR_RED_COLOR_POS, DCR_RED_COLOR_NEG); 
-    }
-
-    if (USE_FIXED_PIXCOORDS) strextend (command, "-D USE_FIXED_PIXCOORDS 1");
-    if (PHOTCODE_KEEP_LIST)  strextend (command, "+photcode %s", PHOTCODE_KEEP_LIST);
-    if (PHOTCODE_SKIP_LIST)  strextend (command, "-photcode %s", PHOTCODE_SKIP_LIST);
-    if (PhotFlagSelect)      strextend (command, "+photflags");
-    if (PhotFlagBad)         strextend (command, "+photflagbad %d", PhotFlagBad); 
-    if (PhotFlagPoor)        strextend (command, "+photflagpoor %d", PhotFlagPoor);
+      strextend (&command, "-dcr-red-color %s %s", DCR_RED_COLOR_POS, DCR_RED_COLOR_NEG); 
+    }
+
+    if (USE_FIXED_PIXCOORDS) strextend (&command, "-D USE_FIXED_PIXCOORDS 1");
+    if (PHOTCODE_KEEP_LIST)  strextend (&command, "+photcode %s", PHOTCODE_KEEP_LIST);
+    if (PHOTCODE_SKIP_LIST)  strextend (&command, "-photcode %s", PHOTCODE_SKIP_LIST);
+    if (PhotFlagSelect)      strextend (&command, "+photflags");
+    if (PhotFlagBad)         strextend (&command, "+photflagbad %d", PhotFlagBad); 
+    if (PhotFlagPoor)        strextend (&command, "+photflagpoor %d", PhotFlagPoor);
     // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values
 
@@ -197,5 +197,5 @@
       char *tstart = ohana_sec_to_date (TSTART);
       char *tstop  = ohana_sec_to_date (TSTOP);
-      strextend (command, "-time %s %s", tstart, tstop); 
+      strextend (&command, "-time %s %s", tstart, tstop); 
       free (tstart);
       free (tstop);
Index: trunk/Ohana/src/relastro/src/load_images.c
===================================================================
--- trunk/Ohana/src/relastro/src/load_images.c	(revision 38062)
+++ trunk/Ohana/src/relastro/src/load_images.c	(revision 38441)
@@ -16,5 +16,5 @@
 
   // convert database table to internal structure
-  image = gfits_table_get_Image (&db[0].ftable, &Nimage, &db[0].swapped);
+  image = gfits_table_get_Image (&db[0].ftable, &Nimage, &db[0].scaledValue, &db[0].nativeOrder);
   if (!image) {
       fprintf (stderr, "ERROR: failed to read images\n");
Index: trunk/Ohana/src/relastro/src/relastro_client.c
===================================================================
--- trunk/Ohana/src/relastro/src/relastro_client.c	(revision 38062)
+++ trunk/Ohana/src/relastro/src/relastro_client.c	(revision 38441)
@@ -69,4 +69,5 @@
       
       set_db (&db);
+      gfits_db_init (&db);
 
       /* lock and load the image db table */
Index: trunk/Ohana/src/relastro/src/relastro_images.c
===================================================================
--- trunk/Ohana/src/relastro/src/relastro_images.c	(revision 38062)
+++ trunk/Ohana/src/relastro/src/relastro_images.c	(revision 38441)
@@ -11,4 +11,5 @@
   /* register database handle with shutdown procedure */
   set_db (&db);
+  gfits_db_init (&db);
 
   /* lock and load the image db table */
Index: trunk/Ohana/src/relastro/src/relastro_merge_source.c
===================================================================
--- trunk/Ohana/src/relastro/src/relastro_merge_source.c	(revision 38062)
+++ trunk/Ohana/src/relastro/src/relastro_merge_source.c	(revision 38441)
@@ -45,5 +45,5 @@
   catalog_src.catformat = dvo_catalog_catformat (CATFORMAT);    // set the default catformat from config data
   catalog_src.catmode   = dvo_catalog_catmode (CATMODE);        // set the default catmode from config data
-  catalog_src.catflags  = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;
+  catalog_src.catflags  = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT;
   catalog_src.Nsecfilt  = GetPhotcodeNsecfilt ();
 
@@ -52,5 +52,5 @@
     exit (1);
   }
-  if (!catalog_src.Naves_disk) {
+  if (!catalog_src.Naverage_disk) {
     fprintf (stderr, "no data in %s, error in cat ID?\n", catalog_src.filename);
     exit (1);
Index: trunk/Ohana/src/relastro/src/relastro_objects.c
===================================================================
--- trunk/Ohana/src/relastro/src/relastro_objects.c	(revision 38062)
+++ trunk/Ohana/src/relastro/src/relastro_objects.c	(revision 38441)
@@ -44,5 +44,5 @@
     catalog.catformat = dvo_catalog_catformat (CATFORMAT);    // set the default catformat from config data
     catalog.catmode   = dvo_catalog_catmode (CATMODE);        // set the default catmode from config data
-    catalog.catflags  = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;
+    catalog.catflags  = DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_MISSING | DVO_LOAD_SECFILT;
     catalog.Nsecfilt  = GetPhotcodeNsecfilt ();
 
@@ -52,5 +52,5 @@
       exit (1);
     }
-    if (!catalog.Naves_disk) {
+    if (!catalog.Naverage_disk) {
       if (VERBOSE2) fprintf (stderr, "no data in %s, skipping\n", catalog.filename);
       dvo_catalog_unlock (&catalog);
@@ -147,42 +147,36 @@
     // SRC_MEAS_TOOFEW
 
-    char command[1024];
-    snprintf (command, 1024, "relastro_client -update-objects -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -statmode %s", 
+    char *command = NULL;
+    strextend (&command, "relastro_client -update-objects -hostID %d -D CATDIR %s -hostdir %s -region %f %f %f %f -statmode %s", 
 	      table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, STATMODE);
 
-    char tmpline[1024];
-    if (FIT_MODE == FIT_PM_ONLY)  	 { snprintf (tmpline, 1024, "%s -pm",    command);           strcpy (command, tmpline); }
-    if (FIT_MODE == FIT_PAR_ONLY) 	 { snprintf (tmpline, 1024, "%s -par",   command);           strcpy (command, tmpline); }
-    if (FIT_MODE == FIT_PM_AND_PAR)      { snprintf (tmpline, 1024, "%s -pmpar", command);           strcpy (command, tmpline); }
-
-    if (VERBOSE)       { snprintf (tmpline, 1024, "%s -v",              command);                    strcpy (command, tmpline); }
-    if (VERBOSE2)      { snprintf (tmpline, 1024, "%s -vv",             command); 		     strcpy (command, tmpline); }
-    if (RESET)         { snprintf (tmpline, 1024, "%s -reset",          command); 		     strcpy (command, tmpline); }
-    if (UPDATE)        { snprintf (tmpline, 1024, "%s -update",         command); 		     strcpy (command, tmpline); }
-
-    if (ImagSelect)    { snprintf (tmpline, 1024, "%s -instmag %f %f",  command, ImagMin, ImagMax);  strcpy (command, tmpline); }
-    if (MaxDensityUse) { snprintf (tmpline, 1024, "%s -max-density %f", command, MaxDensityValue);   strcpy (command, tmpline); }
-    
-    if (FlagOutlier)   { snprintf (tmpline, 1024, "%s -clip %d",        command, CLIP_THRESH);       strcpy (command, tmpline); }
-    
-    if (USE_FIXED_PIXCOORDS) { snprintf (tmpline, 1024, "%s -D USE_FIXED_PIXCOORDS 1", command);     strcpy (command, tmpline); }
-
-    if (PHOTCODE_KEEP_LIST) { snprintf (tmpline, 1024, "%s +photcode %s", command, PHOTCODE_KEEP_LIST); strcpy (command, tmpline); }
-    if (PHOTCODE_SKIP_LIST) { snprintf (tmpline, 1024, "%s -photcode %s", command, PHOTCODE_SKIP_LIST); strcpy (command, tmpline); }
-    if (PhotFlagSelect)    { snprintf (tmpline, 1024, "%s +photflags",   command);                     	strcpy (command, tmpline); }
-    if (PhotFlagBad)       { snprintf (tmpline, 1024, "%s +photflagbad %d", command, PhotFlagBad);     	strcpy (command, tmpline); }
-    if (PhotFlagPoor)      { snprintf (tmpline, 1024, "%s +photflagpoor %d", command, PhotFlagPoor);   	strcpy (command, tmpline); }
+    if (FIT_MODE == FIT_PM_ONLY)  	 { strextend (&command, "-pm"); }
+    if (FIT_MODE == FIT_PAR_ONLY) 	 { strextend (&command, "-par"); }
+    if (FIT_MODE == FIT_PM_AND_PAR)      { strextend (&command, "-pmpar"); }
+
+    if (VERBOSE)       { strextend (&command, "-v"); }
+    if (VERBOSE2)      { strextend (&command, "-vv"); }
+    if (RESET)         { strextend (&command, "-reset"); }
+    if (UPDATE)        { strextend (&command, "-update"); }
+    if (ImagSelect)    { strextend (&command, "-instmag %f %f", ImagMin, ImagMax); }
+    if (MaxDensityUse) { strextend (&command, "-max-density %f", MaxDensityValue); }
+    if (FlagOutlier)   { strextend (&command, "-clip %d", CLIP_THRESH); }
+    if (USE_FIXED_PIXCOORDS) { strextend (&command, "-D USE_FIXED_PIXCOORDS 1"); }
+    if (PHOTCODE_KEEP_LIST)  { strextend (&command, "+photcode %s", PHOTCODE_KEEP_LIST); }
+    if (PHOTCODE_SKIP_LIST)  { strextend (&command, "-photcode %s", PHOTCODE_SKIP_LIST); }
+    if (PhotFlagSelect)      { strextend (&command, "+photflags"); }
+    if (PhotFlagBad)         { strextend (&command, "+photflagbad %d", PhotFlagBad); }
+    if (PhotFlagPoor)        { strextend (&command, "+photflagpoor %d", PhotFlagPoor); }
     // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values
 
-    if (MinBadQF > 0.0)    { snprintf (tmpline, 1024, "%s -min-bad-psfqf %f",        command, MinBadQF);      strcpy (command, tmpline); }
-    if (MaxMeanOffset != 10.0) { snprintf (tmpline, 1024, "%s -max-mean-offset  %f", command, MaxMeanOffset); strcpy (command, tmpline); }
+    if (MinBadQF > 0.0)        { strextend (&command, "-min-bad-psfqf %f", MinBadQF); }
+    if (MaxMeanOffset != 10.0) { strextend (&command, "-max-mean-offset  %f", MaxMeanOffset); }
 
     if (TimeSelect) { 
       char *tstart = ohana_sec_to_date (TSTART);
       char *tstop  = ohana_sec_to_date (TSTOP);
-      snprintf (tmpline, 1024, "%s -time %s %s", command, tstart, tstop); 
+      strextend (&command, "-time %s %s", tstart, tstop); 
       free (tstart);
       free (tstop);
-      strcpy (command, tmpline); 
     }
 
Index: trunk/Ohana/src/relastro/src/relastro_parallel_regions.c
===================================================================
--- trunk/Ohana/src/relastro/src/relastro_parallel_regions.c	(revision 38062)
+++ trunk/Ohana/src/relastro/src/relastro_parallel_regions.c	(revision 38441)
@@ -17,4 +17,5 @@
   // register database handle with shutdown procedure 
   set_db (&db);
+  gfits_db_init (&db);
   db.mode   = dvo_catalog_catmode (CATMODE);
   db.format = dvo_catalog_catformat (CATFORMAT);
