Index: branches/czw_branch/20160809/Ohana/src/relastro/include/relastro.h
===================================================================
--- branches/czw_branch/20160809/Ohana/src/relastro/include/relastro.h	(revision 39761)
+++ branches/czw_branch/20160809/Ohana/src/relastro/include/relastro.h	(revision 39765)
@@ -523,5 +523,5 @@
 void          initGridBins        PROTO((Catalog *catalog, int Ncatalog));
 void          initImageBins       PROTO((Catalog *catalog, int Ncatalog, int FULLINIT));
-void          initImages          PROTO((Image *input, off_t *line_number, off_t N));
+void          initImages          PROTO((Image *input, off_t *line_number, off_t N, int isSubset));
 void          freeImages          PROTO((char *dbImagePtr));
 void          initMosaicBins      PROTO((Catalog *catalog, int Ncatalog));
Index: branches/czw_branch/20160809/Ohana/src/relastro/src/ImageOps.c
===================================================================
--- branches/czw_branch/20160809/Ohana/src/relastro/src/ImageOps.c	(revision 39761)
+++ branches/czw_branch/20160809/Ohana/src/relastro/src/ImageOps.c	(revision 39765)
@@ -6,4 +6,5 @@
 static Image        *image;   // list of available images
 static off_t        Nimage;   // number of available images
+static int         isImageSubset;
 
 // if we read only a subset of the rows from the Image FITS, LineNumber tells us to which row
@@ -78,8 +79,9 @@
 }
 
-void initImages (Image *input, off_t *line_number, off_t N) {
+void initImages (Image *input, off_t *line_number, off_t N, int isSubset) {
 
   off_t i;
 
+  isImageSubset = isSubset;
   image = input;
   LineNumber = line_number;
@@ -136,5 +138,5 @@
   // we call gfits_db_free as well as this function.  sometimes those point at the same
   // memory location, in which case we should only do the free once.
-  if ((void *) dbImagePtr != (void *) image) free (image);
+  if (((void *) dbImagePtr != (void *) image) && isImageSubset) free (image);
   free_astrom_table();
 }
Index: branches/czw_branch/20160809/Ohana/src/relastro/src/UpdateObjectOffsets.c
===================================================================
--- branches/czw_branch/20160809/Ohana/src/relastro/src/UpdateObjectOffsets.c	(revision 39761)
+++ branches/czw_branch/20160809/Ohana/src/relastro/src/UpdateObjectOffsets.c	(revision 39765)
@@ -167,10 +167,14 @@
     strextend (&command, "relastro_client -update-offsets");
     strextend (&command, "-hostID %d", group->hosts[i][0].hostID);
+    strextend (&command, "-hostdir %s", group->hosts[i][0].pathname);
+
     strextend (&command, "-D CATDIR %s", CATDIR);
-    strextend (&command, "-hostdir %s", group->hosts[i][0].pathname);
     strextend (&command, "-region %f %f %f %f", UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax);
     strextend (&command, "-statmode %s", STATMODE);
     strextend (&command, "-minerror %f", MIN_ERROR);
 
+    strextend (&command, "-D RELASTRO_SIGMA_LIM %f", SIGMA_LIM);
+    strextend (&command, "-D RELASTRO_SRC_MEAS_TOOFEW %d", SRC_MEAS_TOOFEW);
+
     if (FIT_MODE == FIT_PM_ONLY)  	 strextend (&command, "-pm");
     if (FIT_MODE == FIT_PAR_ONLY) 	 strextend (&command, "-par");
@@ -180,25 +184,11 @@
     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_ALL_IMAGES)      strextend (&command, "-use-all-images");
     if (USE_FIXED_PIXCOORDS) strextend (&command, "-D USE_FIXED_PIXCOORDS 1"); 
-
-    if (REPAIR_STACKS)          strextend (&command, "-repair-stacks-on-update");
-    if (CHECK_MEASURE_TO_IMAGE) strextend (&command, "-check-measures");
-
-    if (UPDATE_PS1_CHIP_MEASURE) strextend (&command, "-update-ps1-chip");
-    if (UPDATE_HSC_MEASURE)    	 strextend (&command, "-update-hsc");
-    if (UPDATE_CFH_MEASURE)    	 strextend (&command, "-update-cfh");
-
     if (PHOTCODE_KEEP_LIST) strextend (&command, "+photcode %s", PHOTCODE_KEEP_LIST);
     if (PHOTCODE_SKIP_LIST) strextend (&command, "-photcode %s", PHOTCODE_SKIP_LIST);
@@ -208,6 +198,4 @@
     // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values
 
-    if (N_BOOTSTRAP_SAMPLES > 1) strextend (&command, "-bootstrap-samples %d", N_BOOTSTRAP_SAMPLES); 
-
     if (DCR_BLUE_COLOR_POS && DCR_BLUE_COLOR_NEG) {
       strextend (&command, "-dcr-blue-color %s %s", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG); 
@@ -217,6 +205,19 @@
     }
 
+    if (REPAIR_STACKS)          strextend (&command, "-repair-stacks-on-update");
+    if (CHECK_MEASURE_TO_IMAGE) strextend (&command, "-check-measures");
+
+    if (UPDATE_PS1_CHIP_MEASURE) strextend (&command, "-update-ps1-chip");
+    if (UPDATE_HSC_MEASURE)    	 strextend (&command, "-update-hsc");
+    if (UPDATE_CFH_MEASURE)    	 strextend (&command, "-update-cfh");
+
+    if (UPDATE)        strextend (&command, "-update");
+    if (RESET_BAD_IMAGES) strextend (&command, "-reset-bad-images");
+    if (USE_BASIC_CHECK) strextend (&command, "-basic-image-search");
+    if (USE_ALL_IMAGES)      strextend (&command, "-use-all-images");
+
     if (MinBadQF > 0.0)        strextend (&command, "-min-bad-psfqf %f", MinBadQF); 
     if (MaxMeanOffset != 10.0) strextend (&command, "-max-mean-offset  %f", MaxMeanOffset);
+    if (N_BOOTSTRAP_SAMPLES > 1) strextend (&command, "-bootstrap-samples %d", N_BOOTSTRAP_SAMPLES); 
 
     if (TimeSelect) { 
@@ -304,10 +305,14 @@
     strextend (&command, "relastro_client -update-offsets");
     strextend (&command, "-hostID %d", table->hosts[i].hostID);
+    strextend (&command, "-hostdir %s", table->hosts[i].pathname);
+
     strextend (&command, "-D CATDIR %s", CATDIR);
-    strextend (&command, "-hostdir %s", table->hosts[i].pathname);
     strextend (&command, "-region %f %f %f %f", UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax);
     strextend (&command, "-statmode %s", STATMODE);
     strextend (&command, "-minerror %f", MIN_ERROR);
 
+    strextend (&command, "-D RELASTRO_SIGMA_LIM %f", SIGMA_LIM);
+    strextend (&command, "-D RELASTRO_SRC_MEAS_TOOFEW %d", SRC_MEAS_TOOFEW);
+
     if (FIT_MODE == FIT_PM_ONLY)  	 strextend (&command, "-pm");
     if (FIT_MODE == FIT_PAR_ONLY) 	 strextend (&command, "-par");
@@ -317,25 +322,11 @@
     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_ALL_IMAGES)      strextend (&command, "-use-all-images");
     if (USE_FIXED_PIXCOORDS) strextend (&command, "-D USE_FIXED_PIXCOORDS 1"); 
-
-    if (REPAIR_STACKS)          strextend (&command, "-repair-stacks-on-update");
-    if (CHECK_MEASURE_TO_IMAGE) strextend (&command, "-check-measures");
-
-    if (UPDATE_PS1_CHIP_MEASURE) strextend (&command, "-update-ps1-chip");
-    if (UPDATE_HSC_MEASURE)    	 strextend (&command, "-update-hsc");
-    if (UPDATE_CFH_MEASURE)    	 strextend (&command, "-update-cfh");
-
     if (PHOTCODE_KEEP_LIST) strextend (&command, "+photcode %s", PHOTCODE_KEEP_LIST);
     if (PHOTCODE_SKIP_LIST) strextend (&command, "-photcode %s", PHOTCODE_SKIP_LIST);
@@ -345,6 +336,4 @@
     // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values
 
-    if (N_BOOTSTRAP_SAMPLES > 1) strextend (&command, "-bootstrap-samples %d", N_BOOTSTRAP_SAMPLES); 
-
     if (DCR_BLUE_COLOR_POS && DCR_BLUE_COLOR_NEG) {
       strextend (&command, "-dcr-blue-color %s %s", DCR_BLUE_COLOR_POS, DCR_BLUE_COLOR_NEG); 
@@ -353,4 +342,18 @@
       strextend (&command, "-dcr-red-color %s %s", DCR_RED_COLOR_POS, DCR_RED_COLOR_NEG); 
     }
+
+    if (REPAIR_STACKS)          strextend (&command, "-repair-stacks-on-update");
+    if (CHECK_MEASURE_TO_IMAGE) strextend (&command, "-check-measures");
+
+    if (UPDATE_PS1_CHIP_MEASURE) strextend (&command, "-update-ps1-chip");
+    if (UPDATE_HSC_MEASURE)    	 strextend (&command, "-update-hsc");
+    if (UPDATE_CFH_MEASURE)    	 strextend (&command, "-update-cfh");
+
+    if (UPDATE)        strextend (&command, "-update");
+    if (RESET_BAD_IMAGES) strextend (&command, "-reset-bad-images");
+    if (USE_BASIC_CHECK) strextend (&command, "-basic-image-search");
+    if (USE_ALL_IMAGES)      strextend (&command, "-use-all-images");
+
+    if (N_BOOTSTRAP_SAMPLES > 1) strextend (&command, "-bootstrap-samples %d", N_BOOTSTRAP_SAMPLES); 
 
     if (MinBadQF > 0.0)        strextend (&command, "-min-bad-psfqf %f", MinBadQF); 
Index: branches/czw_branch/20160809/Ohana/src/relastro/src/args.c
===================================================================
--- branches/czw_branch/20160809/Ohana/src/relastro/src/args.c	(revision 39761)
+++ branches/czw_branch/20160809/Ohana/src/relastro/src/args.c	(revision 39765)
@@ -509,5 +509,5 @@
   }
 
-  CHIPORDER = 0;
+  CHIPORDER = 1;
   if ((N = get_argument (argc, argv, "-chiporder"))) {
     remove_argument (N, &argc, argv);
@@ -727,4 +727,5 @@
   FREE (BCATALOG);
   FREE (HOSTDIR);
+  FREE (GALAXY_MODEL);
 
   // these are set in initialize
@@ -1207,5 +1208,6 @@
   FREE(HIGH_SPEED_DIR);
   FREE(BCATALOG);
-  FREE (HOSTDIR);
+  FREE(HOSTDIR);
+  FREE(GALAXY_MODEL);
 
   // these are set in initialize
Index: branches/czw_branch/20160809/Ohana/src/relastro/src/assign_images.c
===================================================================
--- branches/czw_branch/20160809/Ohana/src/relastro/src/assign_images.c	(revision 39761)
+++ branches/czw_branch/20160809/Ohana/src/relastro/src/assign_images.c	(revision 39765)
@@ -40,5 +40,5 @@
 
   // register the image array with ImageOps.c for later getimageByID calls
-  initImages (image, NULL, Nimage);
+  initImages (image, NULL, Nimage, FALSE);
 
   if (VERBOSE) fprintf (stderr, "finding images\n");
Index: branches/czw_branch/20160809/Ohana/src/relastro/src/launch_region_hosts.c
===================================================================
--- branches/czw_branch/20160809/Ohana/src/relastro/src/launch_region_hosts.c	(revision 39761)
+++ branches/czw_branch/20160809/Ohana/src/relastro/src/launch_region_hosts.c	(revision 39765)
@@ -81,10 +81,26 @@
     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);
+
+    strextend (&command, "-D RELASTRO_SIGMA_LIM %f", SIGMA_LIM);
+    strextend (&command, "-D RELASTRO_SRC_MEAS_TOOFEW %d", SRC_MEAS_TOOFEW);
+
+    strextend (&command, " -D RELASTRO_MIN_DISTANCE_MOD %f",     MIN_DISTANCE_MOD);
+    strextend (&command, " -D RELASTRO_MAX_DISTANCE_MOD %f",     MAX_DISTANCE_MOD);
+    strextend (&command, " -D RELASTRO_MAX_DISTANCE_MOD_ERR %f", MAX_DISTANCE_MOD_ERR);
+
+    strextend (&command, "-D USE_GALAXY_MODEL %d", USE_GALAXY_MODEL);
+    strextend (&command, "-D USE_ICRF_CORRECT %d", USE_ICRF_CORRECT);
+
+    strextend (&command, "-D RELASTRO_DPOS_MAX %f", DPOS_MAX);
+    strextend (&command, "-D ADDSTAR_RADIUS %f", ADDSTAR_RADIUS);
+
+    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);
 
     switch (FIT_TARGET) {
@@ -108,27 +124,42 @@
     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_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 (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 (TEST_SCALE != 1.0)   strextend (&command, "-testing %f", TEST_SCALE);
+
+    if (SKIP_PS1_CHIP)       strextend (&command, "-skip-ps1-chip");
+    if (SKIP_PS1_STACK)      strextend (&command, "-skip-ps1-stack");
+    if (SKIP_HSC)            strextend (&command, "-skip-hsc");
+    if (SKIP_CFH)            strextend (&command, "-skip-cfh");
+
+    strextend (&command, "-nloop %d", NLOOP);
+    strextend (&command, "-threads %d", NTHREADS);
+    
+    if (PHOTCODE_RESET_LIST) strextend (&command, "-reset-to-photcode %s", PHOTCODE_RESET_LIST);
+
     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 (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 (PhotFlagSelect)     strextend (&command, "+photflags"); 
-    if (PhotFlagBad)        strextend (&command, "+photflagbad %d", PhotFlagBad); 
-    if (PhotFlagPoor)       strextend (&command, "+photflagpoor %d", PhotFlagPoor); 
-
+
+    strextend (&command, "-chiporder %d", CHIPORDER); 
     if (CHIPMAP)            strextend (&command, "-chipmap %d", CHIPMAP); 
     if (RESET_IMAGES)       strextend (&command, "-reset-images"); 
@@ -141,18 +172,4 @@
     if (LoopWeightGAIA)  {  strextend (&command, "-loop-weights-gaia %s", LoopWeightGAIAstr); }
     if (APPLY_PROPER_MOTION) strextend (&command, "-apply-proper-motion");
-
-    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_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 (TimeSelect) { 
Index: branches/czw_branch/20160809/Ohana/src/relastro/src/load_catalogs.c
===================================================================
--- branches/czw_branch/20160809/Ohana/src/relastro/src/load_catalogs.c	(revision 39761)
+++ branches/czw_branch/20160809/Ohana/src/relastro/src/load_catalogs.c	(revision 39765)
@@ -178,37 +178,34 @@
     strextend (&command, "relastro_client -load-objects %s", table->hosts[i].results);
     strextend (&command, " -hostID %d", table->hosts[i].hostID);
+    strextend (&command, " -hostdir %s", table->hosts[i].pathname);
+
     strextend (&command, " -D CATDIR %s", CATDIR);
-    strextend (&command, " -hostdir %s", table->hosts[i].pathname);
     strextend (&command, " -region %f %f %f %f", UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax);
     strextend (&command, " -statmode %s", STATMODE);
     strextend (&command, " -minerror %f", MIN_ERROR);
+
     strextend (&command, " -D RELASTRO_SIGMA_LIM %f", SIGMA_LIM);
+    strextend (&command, " -D RELASTRO_SRC_MEAS_TOOFEW %d", SRC_MEAS_TOOFEW);
+
     strextend (&command, " -D RELASTRO_MIN_DISTANCE_MOD %f",     MIN_DISTANCE_MOD);
     strextend (&command, " -D RELASTRO_MAX_DISTANCE_MOD %f",     MAX_DISTANCE_MOD);
     strextend (&command, " -D RELASTRO_MAX_DISTANCE_MOD_ERR %f", MAX_DISTANCE_MOD_ERR);
 
+    strextend (&command, "-D USE_GALAXY_MODEL %d", USE_GALAXY_MODEL);
+    strextend (&command, "-D USE_ICRF_CORRECT %d", USE_ICRF_CORRECT);
+
     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); 
-    }
-    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_ALL_IMAGES)      strextend (&command, "-use-all-images");
+    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_FIXED_PIXCOORDS) strextend (&command, "-D USE_FIXED_PIXCOORDS 1");
     if (PHOTCODE_KEEP_LIST)  strextend (&command, "+photcode %s", PHOTCODE_KEEP_LIST);
@@ -218,8 +215,17 @@
     if (PhotFlagPoor)        strextend (&command, "+photflagpoor %d", PhotFlagPoor);
 
+    if (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 (SKIP_PS1_CHIP)       strextend (&command, "-skip-ps1-chip");
     if (SKIP_PS1_STACK)      strextend (&command, "-skip-ps1-stack");
     if (SKIP_HSC)            strextend (&command, "-skip-hsc");
     if (SKIP_CFH)            strextend (&command, "-skip-cfh");
+
+    if (USE_ALL_IMAGES)      strextend (&command, "-use-all-images");
 
     // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values
Index: branches/czw_branch/20160809/Ohana/src/relastro/src/load_images.c
===================================================================
--- branches/czw_branch/20160809/Ohana/src/relastro/src/load_images.c	(revision 39761)
+++ branches/czw_branch/20160809/Ohana/src/relastro/src/load_images.c	(revision 39765)
@@ -66,5 +66,5 @@
   }
 
-  initImages (subset, LineNumber, Nsubset);
+  initImages (subset, LineNumber, Nsubset, !USE_ALL_IMAGES);
   MARKTIME("  init images: %f sec\n", dtime);
   
Index: branches/czw_branch/20160809/Ohana/src/relastro/src/relastro_images.c
===================================================================
--- branches/czw_branch/20160809/Ohana/src/relastro/src/relastro_images.c	(revision 39761)
+++ branches/czw_branch/20160809/Ohana/src/relastro/src/relastro_images.c	(revision 39765)
@@ -16,4 +16,7 @@
   int finalPassMode = FIT_MODE; // start with the globally-defined fit mode
   FIT_MODE = FIT_AVERAGE;
+
+  int RESET_ON_UPDATE = RESET;  
+  RESET = TRUE; // we need to reset when we load the bright catalog subset 
 
   /* lock and load the image db table */
@@ -164,4 +167,5 @@
   if (APPLY_OFFSETS) {
     USE_IRLS = ALLOW_IRLS;  // now that we have fitted the images, choose the user's option
+    RESET = RESET_ON_UPDATE;
     UpdateObjectOffsets (skylist, 0, NULL);
   }
Index: branches/czw_branch/20160809/Ohana/src/relastro/src/relastro_objects.c
===================================================================
--- branches/czw_branch/20160809/Ohana/src/relastro/src/relastro_objects.c	(revision 39761)
+++ branches/czw_branch/20160809/Ohana/src/relastro/src/relastro_objects.c	(revision 39765)
@@ -159,8 +159,13 @@
     strextend (&command, "relastro_client -update-objects");
     strextend (&command, "-hostID %d", table->hosts[i].hostID);
+    strextend (&command, "-hostdir %s", table->hosts[i].pathname);
+
     strextend (&command, "-D CATDIR %s", CATDIR);
-    strextend (&command, "-hostdir %s", table->hosts[i].pathname);
     strextend (&command, "-region %f %f %f %f", UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax);
     strextend (&command, "-statmode %s", STATMODE);
+    strextend (&command, "-minerror %f", MIN_ERROR);
+
+    strextend (&command, "-D RELASTRO_SIGMA_LIM %f", SIGMA_LIM);
+    strextend (&command, "-D RELASTRO_SRC_MEAS_TOOFEW %d", SRC_MEAS_TOOFEW);
 
     if (FIT_MODE == FIT_PM_ONLY)  	 { strextend (&command, "-pm"); }
@@ -171,10 +176,10 @@
     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_ALL_IMAGES)      { strextend (&command, "-use-all-images"); }
+    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); }
@@ -185,4 +190,14 @@
     // 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); 
+    }
+    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 (UPDATE)        { strextend (&command, "-update"); }
+    if (USE_ALL_IMAGES)      { strextend (&command, "-use-all-images"); }
+
     if (MinBadQF > 0.0)          strextend (&command, "-min-bad-psfqf %f", MinBadQF); 
     if (MaxMeanOffset != 10.0)   strextend (&command, "-max-mean-offset  %f", MaxMeanOffset); 
Index: branches/czw_branch/20160809/Ohana/src/relastro/src/relastro_parallel_images.c
===================================================================
--- branches/czw_branch/20160809/Ohana/src/relastro/src/relastro_parallel_images.c	(revision 39761)
+++ branches/czw_branch/20160809/Ohana/src/relastro/src/relastro_parallel_images.c	(revision 39765)
@@ -61,5 +61,5 @@
   initMosaics (image, Nimage);
 
-  initImages (image, NULL, Nimage);
+  initImages (image, NULL, Nimage, FALSE);
 
   SkyTable *sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE);
@@ -103,4 +103,8 @@
 
   client_logger_message ("starting the loops: %s\n", myHostName);
+
+  RESET = TRUE; // we need to reset when we load the bright catalog subset 
+  FIT_MODE = FIT_AVERAGE; // we need to only fit the average
+  USE_IRLS = FALSE;  // do not use IRLS yet -- leads to excessive outlier rejections in the loops
 
   /* major modes */
