Index: branches/ccl_branches/ipponly-20191108/ippTools/share/addtool_find_pendingexp_cam.sql
===================================================================
--- branches/ccl_branches/ipponly-20191108/ippTools/share/addtool_find_pendingexp_cam.sql	(revision 41104)
+++ branches/ccl_branches/ipponly-20191108/ippTools/share/addtool_find_pendingexp_cam.sql	(revision 41211)
@@ -7,6 +7,9 @@
     rawExp.camera,
     rawExp.telescope,
-    rawExp.filelevel
+    rawExp.filelevel, 
+    minidvodbRun.minidvodb_host as dvodbhost
 FROM addRun
+JOIN minidvodbRun
+    on addRun.minidvodb_group = minidvodbRun.minidvodb_group
 JOIN camRun
     on cam_id = stage_id
@@ -28,3 +31,4 @@
     AND addRun.workdir IS NOT NULL
     AND addMask.label IS NULL
+    AND minidvodbRun.state = 'active'
 
Index: branches/ccl_branches/ipponly-20191108/ippTools/share/addtool_queue_cam_id.sql
===================================================================
--- branches/ccl_branches/ipponly-20191108/ippTools/share/addtool_queue_cam_id.sql	(revision 41104)
+++ branches/ccl_branches/ipponly-20191108/ippTools/share/addtool_queue_cam_id.sql	(revision 41211)
@@ -16,5 +16,6 @@
 	%d,		-- minidvodb
 	'%s',           -- minidvodb_group 
- 	'%s'	        -- minidvodb_name
+ 	'%s',	        -- minidvodb_name
+ 	'%s'	        -- minidvodb_host
     FROM camRun
     WHERE
Index: branches/ccl_branches/ipponly-20191108/ippTools/share/addtool_queue_diff_id.sql
===================================================================
--- branches/ccl_branches/ipponly-20191108/ippTools/share/addtool_queue_diff_id.sql	(revision 41104)
+++ branches/ccl_branches/ipponly-20191108/ippTools/share/addtool_queue_diff_id.sql	(revision 41211)
@@ -16,5 +16,6 @@
 	%d,		-- minidvodb
 	'%s',           -- minidvodb_group 
- 	'%s'	        -- minidvodb_name
+ 	'%s',           -- minidvodb_name
+ 	'%s'	        -- minidvodb_host
     FROM diffRun
     WHERE
Index: branches/ccl_branches/ipponly-20191108/ippTools/share/addtool_queue_ff_id.sql
===================================================================
--- branches/ccl_branches/ipponly-20191108/ippTools/share/addtool_queue_ff_id.sql	(revision 41104)
+++ branches/ccl_branches/ipponly-20191108/ippTools/share/addtool_queue_ff_id.sql	(revision 41211)
@@ -16,5 +16,6 @@
 	%d,		-- minidvodb
 	'%s',           -- minidvodb_group 
- 	'%s'	        -- minidvodb_name
+ 	'%s',	        -- minidvodb_name
+ 	'%s'	        -- minidvodb_host
     FROM fullForceRun
     WHERE
Index: branches/ccl_branches/ipponly-20191108/ippTools/share/addtool_queue_ffsummary.sql
===================================================================
--- branches/ccl_branches/ipponly-20191108/ippTools/share/addtool_queue_ffsummary.sql	(revision 41104)
+++ branches/ccl_branches/ipponly-20191108/ippTools/share/addtool_queue_ffsummary.sql	(revision 41211)
@@ -16,5 +16,6 @@
 	%d,		-- minidvodb
 	'%s',           -- minidvodb_group 
- 	'%s'	        -- minidvodb_name
+ 	'%s',	        -- minidvodb_name
+ 	'%s'	        -- minidvodb_host
     FROM fullForceRun
     WHERE
Index: branches/ccl_branches/ipponly-20191108/ippTools/share/addtool_queue_sky_id.sql
===================================================================
--- branches/ccl_branches/ipponly-20191108/ippTools/share/addtool_queue_sky_id.sql	(revision 41104)
+++ branches/ccl_branches/ipponly-20191108/ippTools/share/addtool_queue_sky_id.sql	(revision 41211)
@@ -16,5 +16,6 @@
 	%d,		-- minidvodb
 	'%s',           -- minidvodb_group 
- 	'%s'	        -- minidvodb_name
+ 	'%s',	        -- minidvodb_name
+ 	'%s'	        -- minidvodb_host
     FROM staticskyRun
     WHERE
Index: branches/ccl_branches/ipponly-20191108/ippTools/share/addtool_queue_sky_id_multi.sql
===================================================================
--- branches/ccl_branches/ipponly-20191108/ippTools/share/addtool_queue_sky_id_multi.sql	(revision 41104)
+++ branches/ccl_branches/ipponly-20191108/ippTools/share/addtool_queue_sky_id_multi.sql	(revision 41211)
@@ -16,5 +16,6 @@
 	%d,		-- minidvodb
 	'%s',           -- minidvodb_group 
- 	'%s'	        -- minidvodb_name
+ 	'%s',	        -- minidvodb_name
+ 	'%s'	        -- minidvodb_host
     FROM staticskyRun
     WHERE
Index: branches/ccl_branches/ipponly-20191108/ippTools/share/addtool_queue_skycal_id.sql
===================================================================
--- branches/ccl_branches/ipponly-20191108/ippTools/share/addtool_queue_skycal_id.sql	(revision 41104)
+++ branches/ccl_branches/ipponly-20191108/ippTools/share/addtool_queue_skycal_id.sql	(revision 41211)
@@ -16,5 +16,6 @@
 	%d,		-- minidvodb
 	'%s',           -- minidvodb_group 
- 	'%s'	        -- minidvodb_name
+ 	'%s',	        -- minidvodb_name
+ 	'%s'	        -- minidvodb_host
     FROM skycalRun
     WHERE
Index: branches/ccl_branches/ipponly-20191108/ippTools/share/addtool_queue_stack_id.sql
===================================================================
--- branches/ccl_branches/ipponly-20191108/ippTools/share/addtool_queue_stack_id.sql	(revision 41104)
+++ branches/ccl_branches/ipponly-20191108/ippTools/share/addtool_queue_stack_id.sql	(revision 41211)
@@ -16,5 +16,6 @@
 	%d,		-- minidvodb
 	'%s',           -- minidvodb_group 
- 	'%s'	        -- minidvodb_name
+ 	'%s',	        -- minidvodb_name
+ 	'%s'	        -- minidvodb_host
     FROM stackRun
     WHERE
Index: branches/ccl_branches/ipponly-20191108/ippTools/src/addtool.c
===================================================================
--- branches/ccl_branches/ipponly-20191108/ippTools/src/addtool.c	(revision 41104)
+++ branches/ccl_branches/ipponly-20191108/ippTools/src/addtool.c	(revision 41211)
@@ -118,34 +118,34 @@
     psMetadata *where = psMetadataAlloc();
     //  pxcamGetSearchArgs (config, where);
-    PXOPT_COPY_S64(config->args, where,  "-cam_id",    "camRun.cam_id", "==");
-    PXOPT_COPY_S64(config->args, where,  "-stack_id",    "stackRun.stack_id", "==");
+    PXOPT_COPY_S64(config->args, where,  "-cam_id",    "camRun.cam_id",       "==");
+    PXOPT_COPY_S64(config->args, where,  "-stack_id",  "stackRun.stack_id",   "==");
     PXOPT_COPY_S64(config->args, where,  "-sky_id",    "staticskyRun.sky_id", "==");
-    PXOPT_COPY_S64(config->args, where,  "-skycal_id",  "skycalRun.skycal_id", "==");
-    PXOPT_COPY_S64(config->args, where,  "-diff_id",  "diffRun.diff_id", "==");
-    PXOPT_COPY_S64(config->args, where,  "-ff_id",  "fullForceRun.ff_id", "==");
+    PXOPT_COPY_S64(config->args, where,  "-skycal_id", "skycalRun.skycal_id", "==");
+    PXOPT_COPY_S64(config->args, where,  "-diff_id",   "diffRun.diff_id",     "==");
+    PXOPT_COPY_S64(config->args, where,  "-ff_id",     "fullForceRun.ff_id",  "==");
         
     // PXOPT_LOOKUP_STR(stage,       config->args, "-stage", false, false);
-    PXOPT_LOOKUP_STR(workdir,     config->args, "-set_workdir", false, false);
-    PXOPT_LOOKUP_STR(dvodb,       config->args, "-set_dvodb", false, false);
-    PXOPT_LOOKUP_STR(label,       config->args, "-set_label", false, false);
-    PXOPT_LOOKUP_STR(data_group,  config->args, "-set_data_group", false, false);
-    PXOPT_LOOKUP_STR(reduction,   config->args, "-set_reduction", false, false);
-    PXOPT_LOOKUP_STR(note,        config->args, "-set_note", false, false);
-    PXOPT_LOOKUP_STR(minidvodb_name,  config->args, "-set_minidvodb_name", false, false);
+    PXOPT_LOOKUP_STR(workdir,         config->args, "-set_workdir",         false, false);
+    PXOPT_LOOKUP_STR(dvodb,           config->args, "-set_dvodb",           false, false);
+    PXOPT_LOOKUP_STR(label,           config->args, "-set_label",           false, false);
+    PXOPT_LOOKUP_STR(data_group,      config->args, "-set_data_group",      false, false);
+    PXOPT_LOOKUP_STR(reduction,       config->args, "-set_reduction",       false, false);
+    PXOPT_LOOKUP_STR(note,            config->args, "-set_note",            false, false);
+    PXOPT_LOOKUP_BOOL(minidvodb,      config->args, "-set_minidvodb",              false);
     PXOPT_LOOKUP_STR(minidvodb_group, config->args, "-set_minidvodb_group", false, false);
-    PXOPT_LOOKUP_BOOL(image_only, config->args, "-image_only", false);
-    PXOPT_LOOKUP_BOOL(minidvodb,  config->args, "-set_minidvodb", false);
-    PXOPT_LOOKUP_BOOL(destreaked, config->args, "-destreaked", false);
-    PXOPT_LOOKUP_BOOL(uncensored, config->args, "-uncensored", false);
-
-    PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
-
-    PXOPT_LOOKUP_BOOL(pretend,    config->args, "-pretend", false);
-    PXOPT_LOOKUP_BOOL(simple,     config->args, "-simple", false);
+    PXOPT_LOOKUP_STR(minidvodb_name,  config->args, "-set_minidvodb_name",  false, false);
+    PXOPT_LOOKUP_STR(minidvodb_host,  config->args, "-set_minidvodb_host",  false, false);
+    PXOPT_LOOKUP_BOOL(image_only,     config->args, "-image_only",          false);
+    PXOPT_LOOKUP_BOOL(destreaked,     config->args, "-destreaked",          false);
+    PXOPT_LOOKUP_BOOL(uncensored,     config->args, "-uncensored",          false);
+
+    PXOPT_LOOKUP_BOOL(pretend, config->args, "-pretend",       false);
+    PXOPT_LOOKUP_BOOL(simple,  config->args, "-simple",        false);
+    PXOPT_LOOKUP_U64(limit,    config->args, "-limit",  false, false);
    
-    PXOPT_LOOKUP_F32(minra,     config->args, "-set_minra", false, false);
-    PXOPT_LOOKUP_F32(maxra,     config->args, "-set_maxra", false, false);
-    PXOPT_LOOKUP_F32(mindec,     config->args, "-set_mindec", false, false);
-    PXOPT_LOOKUP_F32(maxdec,     config->args, "-set_maxdec", false, false);
+    PXOPT_LOOKUP_F32(minra,  config->args, "-set_minra",  false, false);
+    PXOPT_LOOKUP_F32(maxra,  config->args, "-set_maxra",  false, false);
+    PXOPT_LOOKUP_F32(mindec, config->args, "-set_mindec", false, false);
+    PXOPT_LOOKUP_F32(maxdec, config->args, "-set_maxdec", false, false);
 
     // Handle stages
@@ -153,34 +153,34 @@
     if (strcmp(stage, "cam") == 0) {
       pxcamGetSearchArgs (config, where);
-      pxAddLabelSearchArgs (config, where, "-label",     "camRun.label", "=="); // define using camRun label
-      pxAddLabelSearchArgs (config, where, "-data_group","camRun.data_group", "=="); // define using camRun label
-      PXOPT_COPY_STR(config->args, where,  "-reduction", "camRun.reduction", "==");
+      pxAddLabelSearchArgs (config, where,      "-label",      "camRun.label", "=="); // define using camRun label
+      pxAddLabelSearchArgs (config, where, "-data_group", "camRun.data_group", "=="); // define using camRun label
+      PXOPT_COPY_STR(config->args,  where,  "-reduction",  "camRun.reduction", "==");
     }
     else if (strcmp(stage, "stack") == 0) {
-      pxAddLabelSearchArgs (config, where, "-label",     "stackRun.label", "=="); // define using camRun label
-      pxAddLabelSearchArgs (config, where, "-data_group","stackRun.data_group", "=="); // define using camRun label
-      PXOPT_COPY_STR(config->args, where,  "-reduction", "stackRun.reduction", "==");
-      pxAddLabelSearchArgs (config, where, "-filter",     "stackRun.filter", "=="); // define using camRun label
+      pxAddLabelSearchArgs (config, where,      "-label",      "stackRun.label", "=="); // define using camRun label
+      pxAddLabelSearchArgs (config, where, "-data_group", "stackRun.data_group", "=="); // define using camRun label
+      PXOPT_COPY_STR(config->args,  where,  "-reduction",  "stackRun.reduction", "==");
+      pxAddLabelSearchArgs (config, where,     "-filter",     "stackRun.filter", "=="); // define using camRun label
     }
     else if (strcmp(stage, "staticsky") == 0) {
-      pxAddLabelSearchArgs (config, where, "-label",     "staticskyRun.label", "=="); // define using camRun label
-      pxAddLabelSearchArgs (config, where, "-data_group","staticskyRun.data_group", "=="); // define using camRun label
-      PXOPT_COPY_STR(config->args, where,  "-reduction", "staticskyRun.reduction", "==");
+      pxAddLabelSearchArgs (config, where,      "-label",      "staticskyRun.label", "=="); // define using camRun label
+      pxAddLabelSearchArgs (config, where, "-data_group", "staticskyRun.data_group", "=="); // define using camRun label
+      PXOPT_COPY_STR(config->args,  where,  "-reduction",  "staticskyRun.reduction", "==");
       //no filter here
     }
     else if (strcmp(stage, "skycal") == 0) {
-      pxAddLabelSearchArgs (config, where, "-label",     "skycalRun.label", "=="); //define using skycalRun label
-      pxAddLabelSearchArgs (config, where, "-data_group","skycalRun.data_group", "==");
-      PXOPT_COPY_STR(config->args, where,  "-reduction", "skycalRun.reduction",  "==");
+      pxAddLabelSearchArgs (config, where,      "-label",      "skycalRun.label", "=="); //define using skycalRun label
+      pxAddLabelSearchArgs (config, where, "-data_group", "skycalRun.data_group", "==");
+      PXOPT_COPY_STR(config->args,  where,  "-reduction",  "skycalRun.reduction", "==");
     }
     else if (strcmp(stage, "diff") == 0) {
       pxAddLabelSearchArgs (config, where, "-label",     "diffRun.label", "=="); //define using diffRun label
       pxAddLabelSearchArgs (config, where, "-data_group","diffRun.data_group", "==");
-      PXOPT_COPY_STR(config->args, where,  "-reduction", "diffRun.reduction",  "==");
+      PXOPT_COPY_STR(config->args,  where, "-reduction", "diffRun.reduction",  "==");
     }
     else if (strcmp(stage, "fullforce") == 0) {
       pxAddLabelSearchArgs (config, where, "-label",     "fullForceRun.label", "=="); //define using fullForceRun label
       pxAddLabelSearchArgs (config, where, "-data_group","fullForceRun.data_group", "==");
-      PXOPT_COPY_STR(config->args, where,  "-reduction", "fullForceRun.reduction",  "==");
+      PXOPT_COPY_STR(config->args,  where, "-reduction", "fullForceRun.reduction",  "==");
     }
     else if (strcmp(stage, "fullforce_summary")==0) {
@@ -201,24 +201,24 @@
       //if one of destreaked and uncensored is true, but not both
       if (destreaked) {
-	psTrace("addtool.c", PS_LOG_INFO, "using -destreaked\n");
+        psTrace("addtool.c", PS_LOG_INFO, "using -destreaked\n");
       } else {
-	psTrace("addtool.c", PS_LOG_INFO, "using -unscensored\n");
+        psTrace("addtool.c", PS_LOG_INFO, "using -unscensored\n");
       }
     } else {
       if (destreaked && uncensored) {
-	psError(PS_ERR_UNKNOWN, false, "Both -destreaked and -uncensored are selected. Please use one or the other, not both, \n");
-	return false;
+        psError(PS_ERR_UNKNOWN, false, "Both -destreaked and -uncensored are selected. Please use one or the other, not both, \n");
+        return false;
       }
       if (!destreaked && !uncensored) {
-	psError(PS_ERR_UNKNOWN, false, "Neither -destreaked or -uncensored are selected. Please use one.\n");
-	return false;
+        psError(PS_ERR_UNKNOWN, false, "Neither -destreaked or -uncensored are selected. Please use one.\n");
+        return false;
       }
     }
     if ((strcmp(stage,"diff") == 0) ||
-	(strcmp(stage,"fullforce") == 0) ||
-	(strcmp(stage,"fullforce_summary") == 0)) {
+        (strcmp(stage,"fullforce") == 0) ||
+        (strcmp(stage,"fullforce_summary") == 0)) {
       if (! (dvodb)) {
-	psError(PS_ERR_UNKNOWN, false, "The SQL is not correctly written to handle this case (-set_dvodb not specified), so stopping here.");
-	return(false);
+        psError(PS_ERR_UNKNOWN, false, "The SQL is not correctly written to handle this case (-set_dvodb not specified), so stopping here.");
+        return(false);
       }
     }
@@ -232,11 +232,11 @@
     if (strcmp(stage,"cam") == 0 ) {
       if (dvodb) {
-	psTrace("addtool.c", PS_LOG_INFO, "dvodb argument found (%s) using addtool_find_cam_id_dvo.sql\n%s\n", dvodb,stage);
+        psTrace("addtool.c", PS_LOG_INFO, "dvodb argument found (%s) using addtool_find_cam_id_dvo.sql\n%s\n", dvodb,stage);
         // find the cam_id of all the exposures that we want to queue up.
         bare_query = pxDataGet("addtool_find_cam_id_dvo.sql");
-	// user supplied dvodb
-	psStringAppend(&dvodb_string, "addRun.dvodb = '%s'", dvodb);
+        // user supplied dvodb
+        psStringAppend(&dvodb_string, "addRun.dvodb = '%s'", dvodb);
       } else {
-	psTrace("addtool.c", PS_LOG_INFO, "dvodb argument not found using addtool_find_cam_id.sql\n%s\n",stage);
+        psTrace("addtool.c", PS_LOG_INFO, "dvodb argument not found using addtool_find_cam_id.sql\n%s\n",stage);
         // find the cam_id of all the exposures that we want to queue up.
         bare_query = pxDataGet("addtool_find_cam_id.sql");
@@ -248,11 +248,11 @@
     else if (strcmp(stage,"stack") == 0) {
       if (dvodb) {
-	psTrace("addtool.c", PS_LOG_INFO, "dvodb argument found (%s) using addtool_find_stack_id_dvo.sql\n%s\n", dvodb,stage);
+        psTrace("addtool.c", PS_LOG_INFO, "dvodb argument found (%s) using addtool_find_stack_id_dvo.sql\n%s\n", dvodb,stage);
         // find the cam_id of all the exposures that we want to queue up.
         bare_query = pxDataGet("addtool_find_stack_id_dvo.sql");
-	// user supplied dvodb
-	psStringAppend(&dvodb_string, "addRun.dvodb = '%s'", dvodb);
+        // user supplied dvodb
+        psStringAppend(&dvodb_string, "addRun.dvodb = '%s'", dvodb);
       } else {
-	psTrace("addtool.c", PS_LOG_INFO, "dvodb argument not found using addtool_find_stack_id.sql\n%s\n",stage);
+        psTrace("addtool.c", PS_LOG_INFO, "dvodb argument not found using addtool_find_stack_id.sql\n%s\n",stage);
         // find the cam_id of all the exposures that we want to queue up.
         bare_query = pxDataGet("addtool_find_stack_id.sql");
@@ -264,11 +264,11 @@
     else if (strcmp(stage,"staticsky") == 0) {
       if (dvodb ) {
-	psTrace("addtool.c", PS_LOG_INFO, "dvodb argument found (%s) using addtool_find_sky_id_multi_dvo.sql\n%s\n", dvodb,stage);
+        psTrace("addtool.c", PS_LOG_INFO, "dvodb argument found (%s) using addtool_find_sky_id_multi_dvo.sql\n%s\n", dvodb,stage);
         // find the cam_id of all the exposures that we want to queue up.
         bare_query = pxDataGet("addtool_find_sky_id_multi_dvo.sql");
-	// user supplied dvodb
-	psStringAppend(&dvodb_string, "addRun.dvodb = '%s'", dvodb);
+        // user supplied dvodb
+        psStringAppend(&dvodb_string, "addRun.dvodb = '%s'", dvodb);
       } else {
-	psTrace("addtool.c", PS_LOG_INFO, "dvodb argument not found using addtool_find_sky_id_multi.sql\n%s\n",stage);
+        psTrace("addtool.c", PS_LOG_INFO, "dvodb argument not found using addtool_find_sky_id_multi.sql\n%s\n",stage);
         // find the cam_id of all the exposures that we want to queue up.
         bare_query = pxDataGet("addtool_find_sky_id_multi.sql");
@@ -291,5 +291,5 @@
         // inherit dvodb from skycalRun, avoid matching NULL
         psStringAppend(&dvodb_string, "(skycalRun.dvodb IS NOT NULL AND previous_dvodb = skycalRun.dvodb)");
-	// this is silly, there is no dvodb in skycalRun...?
+        // this is silly, there is no dvodb in skycalRun...?
       }
     }
@@ -308,5 +308,5 @@
         // inherit dvodb from skycalRun, avoid matching NULL
         psStringAppend(&dvodb_string, "(diffRun.dvodb IS NOT NULL AND previous_dvodb = diffRun.dvodb)");
-	// this is silly, there is no dvodb in skycalRun...?
+        // this is silly, there is no dvodb in skycalRun...?
       }
     }
@@ -325,5 +325,5 @@
         // inherit dvodb from skycalRun, avoid matching NULL
         psStringAppend(&dvodb_string, "(fullForceRun.dvodb IS NOT NULL AND previous_dvodb = fullForceRun.dvodb)");
-	// this is silly, there is no dvodb in skycalRun...?
+        // this is silly, there is no dvodb in skycalRun...?
       }
     }
@@ -341,5 +341,5 @@
         // inherit dvodb from skycalRun, avoid matching NULL
         psStringAppend(&dvodb_string, "(fullForceRun.dvodb IS NOT NULL AND previous_dvodb = fullForceRun.dvodb)");
-	// this is silly, there is no dvodb in skycalRun...?
+        // this is silly, there is no dvodb in skycalRun...?
       }
     }
@@ -347,6 +347,6 @@
     if (!bare_query) {
         psError(PXTOOLS_ERR_SYS, false, "failed to retrieve SQL statement");
-	psFree(where);
-	return false;
+        psFree(where);
+        return false;
     }
     
@@ -362,16 +362,15 @@
         psStringAppend(&query, " AND %s", whereClause);
 
-	if ((strcmp(stage,"diff") == 0)||
-	    (strcmp(stage,"fullforce") == 0)||
-	    (strcmp(stage,"fullforce_summary") == 0)) {
-	  //diff needs the ra /deg stuff
-	  //ff needs the ra /deg stuff
-	  //ff summary needs the ra /deg stuff
-	  psStringAppend(&query, " AND radeg >= %f", minra);
-	  psStringAppend(&query, " AND radeg <= %f", maxra);
-	  psStringAppend(&query, " AND decdeg >= %f", mindec);
-	  psStringAppend(&query, " AND decdeg <= %f", maxdec);
-	}
-
+        if ((strcmp(stage,"diff") == 0)||
+            (strcmp(stage,"fullforce") == 0)||
+            (strcmp(stage,"fullforce_summary") == 0)) {
+          //diff needs the ra /deg stuff
+          //ff needs the ra /deg stuff
+          //ff summary needs the ra /deg stuff
+          psStringAppend(&query, " AND radeg >= %f", minra);
+          psStringAppend(&query, " AND radeg <= %f", maxra);
+          psStringAppend(&query, " AND decdeg >= %f", mindec);
+          psStringAppend(&query, " AND decdeg <= %f", maxdec);
+        }
         psFree(whereClause);
     } else {
@@ -384,5 +383,5 @@
       //This picks the magicked/censored ones
       if ((strcmp(stage,"cam") == 0)||
-	  (strcmp(stage,"stack") == 0)) { 
+          (strcmp(stage,"stack") == 0)) { 
         psStringAppend(&query, " AND (camRun.magicked > 0)");
       }
@@ -391,9 +390,9 @@
       //This picks only the unmagicked/uncensored ones
       //if (strcmp(stage,"cam") == 0) {
-	//we can now properly handle the magicked case in ippScripts, so we queue camRuns in any magic state now if -uncensored.
+        //we can now properly handle the magicked case in ippScripts, so we queue camRuns in any magic state now if -uncensored.
         //psStringAppend(&query, " AND (camRun.magicked = 0)");
-	//}
+        //}
       if (strcmp(stage,"stack") == 0) {
-	psStringAppend(&query, " AND (stackRun.magicked = 0)");
+        psStringAppend(&query, " AND (stackRun.magicked = 0)");
       }
     }
@@ -457,7 +456,7 @@
       // negative simple so the default is true
       if (!ippdbPrintMetadatas(stdout, output, "addRun", !simple)) {
-	psError(PS_ERR_UNKNOWN, false, "failed to print array");
-	psFree(output);
-	return false;
+        psError(PS_ERR_UNKNOWN, false, "failed to print array");
+        psFree(output);
+        return false;
       }
       psFree(output);
@@ -469,24 +468,24 @@
       for (long i = 0; i < psArrayLength(output); i++) {
         psMetadata *md = output->data[i];
-	
-	camRunRow *row = camRunObjectFromMetadata(md);
-	
+        
+        camRunRow *row = camRunObjectFromMetadata(md);
+        
         if (!row) {
-	  psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into camRun");
-	  psFree(output);
-	  return false;
-        }
-	
+          psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into camRun");
+          psFree(output);
+          return false;
+        }
+        
         if (!dvodb && !row->dvodb) {
-	  psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined dvodb: label: %s, cam_id %" PRId64, row->label, row->cam_id);
-	  psFree(output);
-	  return false;
+          psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined dvodb: label: %s, cam_id %" PRId64, row->label, row->cam_id);
+          psFree(output);
+          return false;
         }
         if (!workdir && !row->workdir) {
-	  psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined workdir: label: %s, cam_id %" PRId64, row->label, row->cam_id);
-	  psFree(output);
-	  return false;
-        }
-	
+          psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined workdir: label: %s, cam_id %" PRId64, row->label, row->cam_id);
+          psFree(output);
+          return false;
+        }
+        
         psFree(row);
       }
@@ -495,24 +494,24 @@
       for (long i = 0; i < psArrayLength(output); i++) {
         psMetadata *md = output->data[i];
-	
-	stackRunRow *row = stackRunObjectFromMetadata(md);
-	
+        
+        stackRunRow *row = stackRunObjectFromMetadata(md);
+        
         if (!row) {
-	  psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into camRun");
-	  psFree(output);
-	  return false;
-        }
-	
+          psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into camRun");
+          psFree(output);
+          return false;
+        }
+        
         if (!dvodb && !row->dvodb) {
-	  psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined dvodb: label: %s, stack_id %" PRId64, row->label, row->stack_id);
-	  psFree(output);
-	  return false;
+          psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined dvodb: label: %s, stack_id %" PRId64, row->label, row->stack_id);
+          psFree(output);
+          return false;
         }
         if (!workdir && !row->workdir) {
-	  psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined workdir: label: %s, stack_id %" PRId64, row->label, row->stack_id);
-	  psFree(output);
-	  return false;
-        }
-	
+          psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined workdir: label: %s, stack_id %" PRId64, row->label, row->stack_id);
+          psFree(output);
+          return false;
+        }
+        
         psFree(row);
       }
@@ -521,34 +520,34 @@
       for (long i = 0; i < psArrayLength(output); i++) {
         psMetadata *md = output->data[i];
-	bool status = false;
-	psS32 num_inputs = psMetadataLookupS32(&status, md, "num_inputs");
-	if (!status) {
-	  psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item num_inputs");
-	  return false;
-	}
-	if (num_inputs < 0) {
-	  psError(PS_ERR_UNKNOWN, true, "invalid value for num_inputs");
-	  return false;
-	}
-	
-	staticskyRunRow *row = staticskyRunObjectFromMetadata(md);
-	
+        bool status = false;
+        psS32 num_inputs = psMetadataLookupS32(&status, md, "num_inputs");
+        if (!status) {
+          psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item num_inputs");
+          return false;
+        }
+        if (num_inputs < 0) {
+          psError(PS_ERR_UNKNOWN, true, "invalid value for num_inputs");
+          return false;
+        }
+        
+        staticskyRunRow *row = staticskyRunObjectFromMetadata(md);
+        
         if (!row) {
-	  psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into camRun");
-	  psFree(output);
-	  return false;
-        }
-	
+          psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into camRun");
+          psFree(output);
+          return false;
+        }
+        
         if (!dvodb) {  //there's no staticsky.dvodb
-	  psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined dvodb: label: %s, sky_id %" PRId64, row->label, row->sky_id);
-	  psFree(output);
-	  return false;
+          psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined dvodb: label: %s, sky_id %" PRId64, row->label, row->sky_id);
+          psFree(output);
+          return false;
         }
         if (!workdir && !row->workdir) {
-	  psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined workdir: label: %s, sky_id %" PRId64, row->label, row->sky_id);
-	  psFree(output);
-	  return false;
-        }
-	
+          psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined workdir: label: %s, sky_id %" PRId64, row->label, row->sky_id);
+          psFree(output);
+          return false;
+        }
+        
         psFree(row);
       }
@@ -557,24 +556,24 @@
       for (long i = 0; i < psArrayLength(output); i++) {
         psMetadata *md = output->data[i];
-	
+        
         skycalRunRow *row = skycalRunObjectFromMetadata(md);
 
         if (!row) {
-	  psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into skycalRun");
-	  psFree(output);
-	  return false;
-        }
-	
-	if (!dvodb) {  // there's no skycalRun.dvodb
- 	  psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined dvodb: label: %s, skycal_id %" PRId64, row->label, row->skycal_id);
-	  psFree(output);
-	  return false;
+          psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into skycalRun");
+          psFree(output);
+          return false;
+        }
+        
+        if (!dvodb) {  // there's no skycalRun.dvodb
+           psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined dvodb: label: %s, skycal_id %" PRId64, row->label, row->skycal_id);
+          psFree(output);
+          return false;
         }
         if (!workdir && !row->workdir) {
-	  psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined workdir: label: %s, skycal_id %" PRId64, row->label, row->skycal_id);
-	  psFree(output);
-	  return false;
-        }
-	
+          psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined workdir: label: %s, skycal_id %" PRId64, row->label, row->skycal_id);
+          psFree(output);
+          return false;
+        }
+        
         psFree(row);
       }
@@ -583,24 +582,24 @@
       for (long i = 0; i < psArrayLength(output); i++) {
         psMetadata *md = output->data[i];
-	
+        
         diffRunRow *row = diffRunObjectFromMetadata(md);
-	
+        
         if (!row) {
-	  psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into diffRun");
-	  psFree(output);
-	  return false;
-        }
-	
-	if (!dvodb) {  // there's no skycalRun.dvodb
- 	  psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined dvodb: label: %s, diff_id %" PRId64, row->label, row->diff_id);
-	  psFree(output);
-	  return false;
+          psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into diffRun");
+          psFree(output);
+          return false;
+        }
+        
+        if (!dvodb) {  // there's no skycalRun.dvodb
+           psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined dvodb: label: %s, diff_id %" PRId64, row->label, row->diff_id);
+          psFree(output);
+          return false;
         }
         if (!workdir && !row->workdir) {
-	  psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined workdir: label: %s, diff_id %" PRId64, row->label, row->diff_id);
-	  psFree(output);
-	  return false;
-        }
-	
+          psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined workdir: label: %s, diff_id %" PRId64, row->label, row->diff_id);
+          psFree(output);
+          return false;
+        }
+        
         psFree(row);
       }
@@ -609,24 +608,24 @@
       for (long i = 0; i < psArrayLength(output); i++) {
         psMetadata *md = output->data[i];
-	
+        
         fullForceRunRow *row = fullForceRunObjectFromMetadata(md);
-	
+        
         if (!row) {
-	  psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into fullforceRun");
-	  psFree(output);
-	  return false;
-        }
-
-	if (!dvodb) {  // there's no skycalRun.dvodb
- 	  psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined dvodb: label: %s, ff_id %" PRId64, row->label, row->ff_id);
-	  psFree(output);
-	  return false;
+          psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into fullforceRun");
+          psFree(output);
+          return false;
+        }
+
+        if (!dvodb) {  // there's no skycalRun.dvodb
+           psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined dvodb: label: %s, ff_id %" PRId64, row->label, row->ff_id);
+          psFree(output);
+          return false;
         }
         if (!workdir && !row->workdir) {
-	  psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined workdir: label: %s, ff_id %" PRId64, row->label, row->ff_id);
-	  psFree(output);
-	  return false;
-        }
-	
+          psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined workdir: label: %s, ff_id %" PRId64, row->label, row->ff_id);
+          psFree(output);
+          return false;
+        }
+        
         psFree(row);
       }
@@ -635,24 +634,24 @@
       for (long i = 0; i < psArrayLength(output); i++) {
         psMetadata *md = output->data[i];
-	//i believe this is correct for ff_summary as well:
+        //i believe this is correct for ff_summary as well:
         fullForceRunRow *row = fullForceRunObjectFromMetadata(md);
-	
+        
         if (!row) {
-	  psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into fullforceRun");
-	  psFree(output);
-	  return false;
-        }
-	
-	if (!dvodb) {  // there's no skycalRun.dvodb
- 	  psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined dvodb: label: %s, ff_id %" PRId64, row->label, row->ff_id);
-	  psFree(output);
-	  return false;
+          psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into fullforceRun");
+          psFree(output);
+          return false;
+        }
+        
+        if (!dvodb) {  // there's no skycalRun.dvodb
+           psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined dvodb: label: %s, ff_id %" PRId64, row->label, row->ff_id);
+          psFree(output);
+          return false;
         }
         if (!workdir && !row->workdir) {
-	  psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined workdir: label: %s, ff_id %" PRId64, row->label, row->ff_id);
-	  psFree(output);
-	  return false;
-        }
-	
+          psError(PS_ERR_UNKNOWN, false, "cannot queue addstar run without a defined workdir: label: %s, ff_id %" PRId64, row->label, row->ff_id);
+          psFree(output);
+          return false;
+        }
+        
         psFree(row);
       }
@@ -678,20 +677,20 @@
       for (long i = 0; i < psArrayLength(output); i++) {
         psMetadata *md = output->data[i];
-	psS64 stage_id =0; 
-	
-	camRunRow *row = camRunObjectFromMetadata(md);
-	stage_id = row->cam_id;
-	
+        psS64 stage_id =0; 
+        
+        camRunRow *row = camRunObjectFromMetadata(md);
+        stage_id = row->cam_id;
+        
         if (!row) {
-	  psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into camRun");
-	  psFree(output);
-	  return false;
-        }
-	
+          psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into camRun");
+          psFree(output);
+          return false;
+        }
+        
         // queue the exp
         if (!pxaddQueueByCamID(config,
-			       stage,
+                               stage,
                                stage_id,
-			       0,
+                               0,
                                workdir     ? workdir   : row->workdir,
                                reduction   ? reduction : row->reduction,
@@ -703,14 +702,15 @@
                                minidvodb,
                                minidvodb_group,
-                               minidvodb_name
-			       )) {
-	  if (!psDBRollback(config->dbh)) {
-	    psError(PS_ERR_UNKNOWN, false, "database error sfg");
-	  }
-	  psError(PS_ERR_UNKNOWN, false,
-		  "failed to trying to queue stage %s %" PRId64,stage, stage_id);
-	  psFree(row);
-	  psFree(output);
-	  return false;
+                               minidvodb_name,
+                               minidvodb_host
+                               )) {
+          if (!psDBRollback(config->dbh)) {
+            psError(PS_ERR_UNKNOWN, false, "database error sfg");
+          }
+          psError(PS_ERR_UNKNOWN, false,
+                  "failed to trying to queue stage %s %" PRId64,stage, stage_id);
+          psFree(row);
+          psFree(output);
+          return false;
         }
         psFree(row);
@@ -720,20 +720,20 @@
       for (long i = 0; i < psArrayLength(output); i++) {
         psMetadata *md = output->data[i];
-	psS64 stage_id =0; 
-	
-	stackRunRow *row = stackRunObjectFromMetadata(md);
-	stage_id = row->stack_id;
-	
+        psS64 stage_id =0; 
+        
+        stackRunRow *row = stackRunObjectFromMetadata(md);
+        stage_id = row->stack_id;
+        
         if (!row) {
-	  psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into camRun");
-	  psFree(output);
-	  return false;
-        }
-	
+          psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into camRun");
+          psFree(output);
+          return false;
+        }
+        
         // queue the exp
         if (!pxaddQueueByCamID(config,
-			       stage,
+                               stage,
                                stage_id,
-			       0,
+                               0,
                                workdir     ? workdir   : row->workdir,
                                reduction   ? reduction : row->reduction,
@@ -745,14 +745,15 @@
                                minidvodb,
                                minidvodb_group,
-                               minidvodb_name
-			       )) {
-	  if (!psDBRollback(config->dbh)) {
-	    psError(PS_ERR_UNKNOWN, false, "database error sfg");
-	  }
-	  psError(PS_ERR_UNKNOWN, false,
-		  "failed to trying to queue stage %s %" PRId64,stage, stage_id);
-	  psFree(row);
-	  psFree(output);
-	  return false;
+                               minidvodb_name,
+                               minidvodb_host
+                               )) {
+          if (!psDBRollback(config->dbh)) {
+            psError(PS_ERR_UNKNOWN, false, "database error sfg");
+          }
+          psError(PS_ERR_UNKNOWN, false,
+                  "failed to trying to queue stage %s %" PRId64,stage, stage_id);
+          psFree(row);
+          psFree(output);
+          return false;
         }
         psFree(row);
@@ -762,28 +763,28 @@
       for (long i = 0; i < psArrayLength(output); i++) {
         psMetadata *md = output->data[i];
-	psS64 stage_id =0; 
-	bool status = false;
-	//psS32 num_inputs = psMetadataLookupS32(&status, md, "num_inputs");
-	psS32 stack_id = psMetadataLookupS32(&status, md, "stack_id");
-	
-	if (!status) {
-	  psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stack_id");
-	  return false;
-	}
-	staticskyRunRow *row = staticskyRunObjectFromMetadata(md);
-	stage_id = row->sky_id;
-	
+        psS64 stage_id =0; 
+        bool status = false;
+        //psS32 num_inputs = psMetadataLookupS32(&status, md, "num_inputs");
+        psS32 stack_id = psMetadataLookupS32(&status, md, "stack_id");
+        
+        if (!status) {
+          psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stack_id");
+          return false;
+        }
+        staticskyRunRow *row = staticskyRunObjectFromMetadata(md);
+        stage_id = row->sky_id;
+        
         if (!row) {
-	  psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into camRun");
-	  psFree(output);
-	  return false;
-        }
-	
+          psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into camRun");
+          psFree(output);
+          return false;
+        }
+        
         // queue the exp
-      	//for (int filter_id = 0; filter_id < num_inputs; filter_id++) {  
-	if (!pxaddQueueByCamID(config,
-			       stage,
-			       stage_id,
-			       stack_id,
+              //for (int filter_id = 0; filter_id < num_inputs; filter_id++) {  
+        if (!pxaddQueueByCamID(config,
+                               stage,
+                               stage_id,
+                               stack_id,
                                workdir     ? workdir   : row->workdir,
                                reduction   ? reduction : row->reduction,
@@ -795,16 +796,17 @@
                                minidvodb,
                                minidvodb_group,
-                               minidvodb_name
-			       )) {
-	  if (!psDBRollback(config->dbh)) {
-	    psError(PS_ERR_UNKNOWN, false, "database error sfg");
-	  }
-	  psError(PS_ERR_UNKNOWN, false,
-		  "failed to trying to queue stage %s %" PRId64,stage, stage_id);
-	  psFree(row);
-	  psFree(output);
-	  return false;
-	}
-	//}
+                               minidvodb_name,
+                               minidvodb_host
+                               )) {
+          if (!psDBRollback(config->dbh)) {
+            psError(PS_ERR_UNKNOWN, false, "database error sfg");
+          }
+          psError(PS_ERR_UNKNOWN, false,
+                  "failed to trying to queue stage %s %" PRId64,stage, stage_id);
+          psFree(row);
+          psFree(output);
+          return false;
+        }
+        //}
         psFree(row);
       }
@@ -813,20 +815,20 @@
       for (long i = 0; i < psArrayLength(output); i++) {
         psMetadata *md = output->data[i];
-	psS64 stage_id =0; 
-	
-	skycalRunRow *row = skycalRunObjectFromMetadata(md);
-	stage_id = row->skycal_id;
-	
+        psS64 stage_id =0; 
+        
+        skycalRunRow *row = skycalRunObjectFromMetadata(md);
+        stage_id = row->skycal_id;
+        
         if (!row) {
-	  psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into skycalRun");
-	  psFree(output);
-	  return false;
-        }
-	
+          psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into skycalRun");
+          psFree(output);
+          return false;
+        }
+        
         // queue the exp
         if (!pxaddQueueByCamID(config,
-			       stage,
+                               stage,
                                stage_id,
-			       0,
+                               0,
                                workdir     ? workdir   : row->workdir,
                                reduction   ? reduction : row->reduction,
@@ -838,14 +840,15 @@
                                minidvodb,
                                minidvodb_group,
-                               minidvodb_name
-			       )) {
-	  if (!psDBRollback(config->dbh)) {
-	    psError(PS_ERR_UNKNOWN, false, "database error sfg");
-	  }
-	  psError(PS_ERR_UNKNOWN, false,
-		  "failed to trying to queue stage %s %" PRId64,stage, stage_id);
-	  psFree(row);
-	  psFree(output);
-	  return false;
+                               minidvodb_name,
+                               minidvodb_host
+                               )) {
+          if (!psDBRollback(config->dbh)) {
+            psError(PS_ERR_UNKNOWN, false, "database error sfg");
+          }
+          psError(PS_ERR_UNKNOWN, false,
+                  "failed to trying to queue stage %s %" PRId64,stage, stage_id);
+          psFree(row);
+          psFree(output);
+          return false;
         }
         psFree(row);
@@ -855,26 +858,26 @@
       for (long i = 0; i < psArrayLength(output); i++) {
         psMetadata *md = output->data[i];
-	psS64 stage_id =0; 
-	//	psS64 stage_extra1 = 0;
-	diffRunRow *row = diffRunObjectFromMetadata(md);
-	stage_id = row->diff_id;
-	bool status = false;
-	psS32 stage_extra1 = psMetadataLookupS32(&status, md, "diff_skyfile_id");
-	if (!status) {
-	  psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item diff_skyfile_id");
-	  return false;
-	}
-	
+        psS64 stage_id =0; 
+        //        psS64 stage_extra1 = 0;
+        diffRunRow *row = diffRunObjectFromMetadata(md);
+        stage_id = row->diff_id;
+        bool status = false;
+        psS32 stage_extra1 = psMetadataLookupS32(&status, md, "diff_skyfile_id");
+        if (!status) {
+          psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item diff_skyfile_id");
+          return false;
+        }
+        
         if (!row) {
-	  psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into skycalRun");
-	  psFree(output);
-	  return false;
-        }
-	
+          psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into skycalRun");
+          psFree(output);
+          return false;
+        }
+        
         // queue the exp
         if (!pxaddQueueByCamID(config,
-			       stage,
+                               stage,
                                stage_id,
-			       stage_extra1,
+                               stage_extra1,
                                workdir     ? workdir   : row->workdir,
                                reduction   ? reduction : row->reduction,
@@ -886,14 +889,15 @@
                                minidvodb,
                                minidvodb_group,
-                               minidvodb_name
-			       )) {
-	  if (!psDBRollback(config->dbh)) {
-	    psError(PS_ERR_UNKNOWN, false, "database error sfg");
-	  }
-	  psError(PS_ERR_UNKNOWN, false,
-		  "failed to trying to queue stage %s %" PRId64,stage, stage_id);
-	  psFree(row);
-	  psFree(output);
-	  return false;
+                               minidvodb_name,
+                               minidvodb_host
+                               )) {
+          if (!psDBRollback(config->dbh)) {
+            psError(PS_ERR_UNKNOWN, false, "database error sfg");
+          }
+          psError(PS_ERR_UNKNOWN, false,
+                  "failed to trying to queue stage %s %" PRId64,stage, stage_id);
+          psFree(row);
+          psFree(output);
+          return false;
         }
         psFree(row);
@@ -903,26 +907,26 @@
       for (long i = 0; i < psArrayLength(output); i++) {
         psMetadata *md = output->data[i];
-	psS64 stage_id =0; 
-	
-	fullForceRunRow *row = fullForceRunObjectFromMetadata(md);
-	stage_id = row->ff_id;
-	bool status = false;
-	psS32 stage_extra1 = psMetadataLookupS32(&status, md, "warp_id");
-	if (!status) {
-	  psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item warp_id");
-	  return false;
-	}
-	
+        psS64 stage_id =0; 
+        
+        fullForceRunRow *row = fullForceRunObjectFromMetadata(md);
+        stage_id = row->ff_id;
+        bool status = false;
+        psS32 stage_extra1 = psMetadataLookupS32(&status, md, "warp_id");
+        if (!status) {
+          psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item warp_id");
+          return false;
+        }
+        
         if (!row) {
-	  psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into skycalRun");
-	  psFree(output);
-	  return false;
-        }
-	
+          psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into skycalRun");
+          psFree(output);
+          return false;
+        }
+        
         // queue the exp
         if (!pxaddQueueByCamID(config,
-			       stage,
+                               stage,
                                stage_id,
-			       stage_extra1,
+                               stage_extra1,
                                workdir     ? workdir   : row->workdir,
                                reduction   ? reduction : row->reduction,
@@ -934,14 +938,15 @@
                                minidvodb,
                                minidvodb_group,
-                               minidvodb_name
-			       )) {
-	  if (!psDBRollback(config->dbh)) {
-	    psError(PS_ERR_UNKNOWN, false, "database error sfg");
-	  }
-	  psError(PS_ERR_UNKNOWN, false,
-		  "failed to trying to queue stage %s %" PRId64,stage, stage_id);
-	  psFree(row);
-	  psFree(output);
-	  return false;
+                               minidvodb_name,
+                               minidvodb_host
+                               )) {
+          if (!psDBRollback(config->dbh)) {
+            psError(PS_ERR_UNKNOWN, false, "database error sfg");
+          }
+          psError(PS_ERR_UNKNOWN, false,
+                  "failed to trying to queue stage %s %" PRId64,stage, stage_id);
+          psFree(row);
+          psFree(output);
+          return false;
         }
         psFree(row);
@@ -951,20 +956,20 @@
       for (long i = 0; i < psArrayLength(output); i++) {
         psMetadata *md = output->data[i];
-	psS64 stage_id =0; 
-	
-	fullForceRunRow *row = fullForceRunObjectFromMetadata(md);
-	stage_id = row->ff_id;
-	
+        psS64 stage_id =0; 
+        
+        fullForceRunRow *row = fullForceRunObjectFromMetadata(md);
+        stage_id = row->ff_id;
+        
         if (!row) {
-	  psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into fullforceRun");
-	  psFree(output);
-	  return false;
-        }
-	
+          psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into fullforceRun");
+          psFree(output);
+          return false;
+        }
+        
         // queue the exp
         if (!pxaddQueueByCamID(config,
-			       stage,
+                               stage,
                                stage_id,
-			       0,
+                               0,
                                workdir     ? workdir   : row->workdir,
                                reduction   ? reduction : row->reduction,
@@ -976,14 +981,15 @@
                                minidvodb,
                                minidvodb_group,
-                               minidvodb_name
-			       )) {
-	  if (!psDBRollback(config->dbh)) {
-	    psError(PS_ERR_UNKNOWN, false, "database error sfg");
-	  }
-	  psError(PS_ERR_UNKNOWN, false,
-		  "failed to trying to queue stage %s %" PRId64,stage, stage_id);
-	  psFree(row);
-	  psFree(output);
-	  return false;
+                               minidvodb_name,
+                               minidvodb_host
+                               )) {
+          if (!psDBRollback(config->dbh)) {
+            psError(PS_ERR_UNKNOWN, false, "database error sfg");
+          }
+          psError(PS_ERR_UNKNOWN, false,
+                  "failed to trying to queue stage %s %" PRId64,stage, stage_id);
+          psFree(row);
+          psFree(output);
+          return false;
         }
         psFree(row);
@@ -1006,18 +1012,18 @@
 
     psMetadata *where = psMetadataAlloc();
-    PXOPT_COPY_S64(config->args, where, "-add_id",    "addRun.add_id", "==");
-    PXOPT_COPY_S64(config->args, where, "-cam_id",    "camRun.cam_id", "==");
-    PXOPT_COPY_S64(config->args, where, "-stack_id",    "stackRun.stack_id", "==");
+    PXOPT_COPY_S64(config->args, where, "-add_id",    "addRun.add_id",       "==");
+    PXOPT_COPY_S64(config->args, where, "-cam_id",    "camRun.cam_id",       "==");
+    PXOPT_COPY_S64(config->args, where, "-stack_id",  "stackRun.stack_id",   "==");
     PXOPT_COPY_S64(config->args, where, "-sky_id",    "staticskyRun.sky_id", "==");
     PXOPT_COPY_S64(config->args, where, "-skycal_id", "skycalRun.skycal_id", "==");
-    PXOPT_COPY_S64(config->args, where, "-diff_id", "diffRun.diff_id", "==");
-    PXOPT_COPY_S64(config->args, where, "-ff_id", "fullForceRun.ff_id", "==");
+    PXOPT_COPY_S64(config->args, where, "-diff_id",   "diffRun.diff_id",     "==");
+    PXOPT_COPY_S64(config->args, where, "-ff_id",     "fullForceRun.ff_id",  "==");
 
     PXOPT_LOOKUP_STR(stage,       config->args, "-stage", false, false);
     pxcamGetSearchArgs (config, where); // most search arguments based on camera
-    PXOPT_COPY_STR(config->args, where, "-label",     "addRun.label", "==");
-    PXOPT_COPY_STR(config->args, where, "-state",     "addRun.state", "==");
+    PXOPT_COPY_STR(config->args, where, "-label",     "addRun.label",     "==");
+    PXOPT_COPY_STR(config->args, where, "-state",     "addRun.state",     "==");
     PXOPT_COPY_STR(config->args, where, "-reduction", "addRun.reduction", "==");
-    PXOPT_COPY_STR(config->args, where, "-dvodb", "addRun.dvodb", "==");
+    PXOPT_COPY_STR(config->args, where, "-dvodb",     "addRun.dvodb",     "==");
 
     if (!psListLength(where->list)) {
@@ -1135,7 +1141,7 @@
       //this group by is needed to join against all the warps (to get camera)
       if (multiadd) {
-	psStringAppend(&query, " GROUP BY %s", "diff_id");
+        psStringAppend(&query, " GROUP BY %s", "diff_id");
       } else {
-	psStringAppend(&query, " GROUP BY %s", "diff_id, stage_extra1");
+        psStringAppend(&query, " GROUP BY %s", "diff_id, stage_extra1");
       }
     }
@@ -1143,7 +1149,7 @@
       //this group by is needed to join against all the warps (to get camera)
       if (multiadd) {
-	psStringAppend(&query, "GROUP BY %s", "ff_id");
+        psStringAppend(&query, "GROUP BY %s", "ff_id");
       } else {
-	psStringAppend(&query, " GROUP BY %s", "ff_id, stage_extra1");
+        psStringAppend(&query, " GROUP BY %s", "ff_id, stage_extra1");
       }
     }
@@ -1199,12 +1205,13 @@
     
     // optional
-    PXOPT_LOOKUP_STR(path_base,     config->args, "-path_base", false, false);
-    PXOPT_LOOKUP_F32(dtime_addstar, config->args, "-dtime_addstar", false, false);
-    PXOPT_LOOKUP_STR(dvodb_path, config->args, "-dvodb_path", false, false);
+    PXOPT_LOOKUP_STR(path_base,      config->args, "-path_base",      false, false);
+    PXOPT_LOOKUP_F32(dtime_addstar,  config->args, "-dtime_addstar",  false, false);
+    PXOPT_LOOKUP_STR(dvodb_path,     config->args, "-dvodb_path",     false, false);
     PXOPT_LOOKUP_STR(minidvodb_name, config->args, "-minidvodb_name", false, false);
-    PXOPT_LOOKUP_S16(fault,         config->args, "-fault", false, false);
-    PXOPT_LOOKUP_S64(stage_extra1, config->args, "-stage_extra1", false, false);
-    
-    PXOPT_LOOKUP_BOOL(multiadd, config->args, "-multiadd", false);
+    PXOPT_LOOKUP_STR(minidvodb_host, config->args, "-minidvodb_host", false, false);
+    PXOPT_LOOKUP_S16(fault,          config->args, "-fault",          false, false);
+    PXOPT_LOOKUP_S64(stage_extra1,   config->args, "-stage_extra1",   false, false);
+
+    PXOPT_LOOKUP_BOOL(multiadd,      config->args, "-multiadd",              false);
     // generate restrictions
     psMetadata *where = psMetadataAlloc();
@@ -1247,5 +1254,5 @@
       PXOPT_LOOKUP_STR(stage_extra1_list, config->args, "-stage_extra1_list", false, false);
       if (stage_extra1_list) {
-	psStringAppend(&query, " AND stage_extra1 IN (%s)", stage_extra1_list);
+        psStringAppend(&query, " AND stage_extra1 IN (%s)", stage_extra1_list);
       }
     }
@@ -1286,15 +1293,15 @@
       
       addProcessedExpRow *row = addProcessedExpRowAlloc(
-							pendingRow->add_id,
-							dtime_addstar,
-							path_base,
-							dvodb_path,
-							fault
-							);
+                                                        pendingRow->add_id,
+                                                        dtime_addstar,
+                                                        path_base,
+                                                        dvodb_path,
+                                                        fault
+                                                        );
       
       if (!addProcessedExpInsertObject(config->dbh, row)) {
         // rollback
         if (!psDBRollback(config->dbh)) {
-	  psError(PS_ERR_UNKNOWN, false, "database error");
+          psError(PS_ERR_UNKNOWN, false, "database error");
         }
         psError(PS_ERR_UNKNOWN, false, "database error");
@@ -1306,33 +1313,45 @@
       //if there is a minidvodb_name, set it in addRun (it's not known until it is processed)
       if (minidvodb_name) {
-	psString setName = NULL;
-	psStringAppend (&setName, "UPDATE addRun set minidvodb_name = '%s' where add_id = %" PRId64, minidvodb_name, row->add_id);
-	if (!p_psDBRunQuery(config->dbh, setName)) {
-	  if (!psDBRollback(config->dbh)) {
-	    psError(PS_ERR_UNKNOWN, false, "database error");
-	  }
-	  psError(PS_ERR_UNKNOWN, false, "database error");
-	  
-	  return false;
-	}
-      }
+        psString setName = NULL;
+        psStringAppend (&setName, "UPDATE addRun set minidvodb_name = '%s' where add_id = %" PRId64, minidvodb_name, row->add_id);
+        if (!p_psDBRunQuery(config->dbh, setName)) {
+          if (!psDBRollback(config->dbh)) {
+            psError(PS_ERR_UNKNOWN, false, "database error");
+          }
+          psError(PS_ERR_UNKNOWN, false, "database error");
+          
+          return false;
+        }
+      }
+
+      //if there is a minidvodb_host, set it in addRun (it's not known until it is processed)
+      if (minidvodb_host) {
+        psString setName = NULL;
+        psStringAppend (&setName, "UPDATE addRun set minidvodb_host = '%s' where add_id = %" PRId64, minidvodb_host, row->add_id);
+        if (!p_psDBRunQuery(config->dbh, setName)) {
+          if (!psDBRollback(config->dbh)) {
+            psError(PS_ERR_UNKNOWN, false, "database error");
+          }
+          psError(PS_ERR_UNKNOWN, false, "database error");
+          
+          return false;
+        }
+      }
+
       //if there is a stage_extra1, set it in addRun (it's not known until it is processed)
       if (stage_extra1) {
-	psString setExtra = NULL;
-	psStringAppend (&setExtra, "UPDATE addRun set stage_extra1 = %" PRId64, stage_extra1);
-	psStringAppend (&setExtra, " where add_id = %" PRId64, row->add_id);
-	
-	if (!p_psDBRunQuery(config->dbh, setExtra)) {
-	  if (!psDBRollback(config->dbh)) {
-	    psError(PS_ERR_UNKNOWN, false, "database error");
-	  }
-	  psError(PS_ERR_UNKNOWN, false, "database error");
-	  
-	  return false;
-	}
-      }
-      
-      
-      
+        psString setExtra = NULL;
+        psStringAppend (&setExtra, "UPDATE addRun set stage_extra1 = %" PRId64, stage_extra1);
+        psStringAppend (&setExtra, " where add_id = %" PRId64, row->add_id);
+        
+        if (!p_psDBRunQuery(config->dbh, setExtra)) {
+          if (!psDBRollback(config->dbh)) {
+            psError(PS_ERR_UNKNOWN, false, "database error");
+          }
+          psError(PS_ERR_UNKNOWN, false, "database error");
+          
+          return false;
+        }
+      }
       
       // since there is only one exp per 'new' set addRun.state = 'full'
@@ -1340,10 +1359,10 @@
       
       if (!fault) {
-	if (!pxaddRunSetState(config, row->add_id, "full")) {
-	  psError(PS_ERR_UNKNOWN, false, "failed to change addRun.state for add_id: %" PRId64, row->add_id);
-	  psFree(row);
-	  psFree(pendingRow);
-	  return false;
-	}
+        if (!pxaddRunSetState(config, row->add_id, "full")) {
+          psError(PS_ERR_UNKNOWN, false, "failed to change addRun.state for add_id: %" PRId64, row->add_id);
+          psFree(row);
+          psFree(pendingRow);
+          return false;
+        }
       }
       psFree(row);
@@ -1506,51 +1525,51 @@
       psString query = NULL;
       if (strcmp(stage, "cam") == 0) {
-	query = pxDataGet("addtool_revertprocessedexp_cam.sql");
+        query = pxDataGet("addtool_revertprocessedexp_cam.sql");
       }
       else if (strcmp(stage, "stack") == 0) {
-	query = pxDataGet("addtool_revertprocessedexp_stack.sql");
+        query = pxDataGet("addtool_revertprocessedexp_stack.sql");
       }
       else if (strcmp(stage, "staticsky") == 0) {
-	query = pxDataGet("addtool_revertprocessedexp_staticsky_multi.sql");
+        query = pxDataGet("addtool_revertprocessedexp_staticsky_multi.sql");
       }
       else if (strcmp(stage, "skycal") == 0) {
-	query = pxDataGet("addtool_revertprocessedexp_skycal.sql");
+        query = pxDataGet("addtool_revertprocessedexp_skycal.sql");
       }
       else if (strcmp(stage, "diff") == 0) {
-	query = pxDataGet("addtool_revertprocessedexp_diff.sql");
+        query = pxDataGet("addtool_revertprocessedexp_diff.sql");
       }
       else if (strcmp(stage, "fullforce") == 0) {
-	query = pxDataGet("addtool_revertprocessedexp_ff.sql");
+        query = pxDataGet("addtool_revertprocessedexp_ff.sql");
       }
       else if (strcmp(stage, "fullforce_summary") == 0) {
-	query = pxDataGet("addtool_revertprocessedexp_ffsummary.sql");
+        query = pxDataGet("addtool_revertprocessedexp_ffsummary.sql");
       }
      
       if (!query) {
-	// rollback
-	if (!psDBRollback(config->dbh)) {
-	  psError(PS_ERR_UNKNOWN, false, "database error");
-	}
-	psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
-	psFree(where);
-	return false;
+        // rollback
+        if (!psDBRollback(config->dbh)) {
+          psError(PS_ERR_UNKNOWN, false, "database error");
+        }
+        psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
+        psFree(where);
+        return false;
       }
       
       // use psDBGenerateWhereConditionalSQL with AND ... because the SQL ends in a WHERE
       if (where && psListLength(where->list)) {
-	psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
-	psStringAppend(&query, " AND %s", whereClause);
-	psFree(whereClause);
+        psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
+        psStringAppend(&query, " AND %s", whereClause);
+        psFree(whereClause);
       }
       
       if (!p_psDBRunQuery(config->dbh, query)) {
-	// rollback
-	if (!psDBRollback(config->dbh)) {
-	  psError(PS_ERR_UNKNOWN, false, "database error");
-	}
-	psError(PS_ERR_UNKNOWN, false, "database error");
-	psFree(query);
-	psFree(where);
-	return false;
+        // rollback
+        if (!psDBRollback(config->dbh)) {
+          psError(PS_ERR_UNKNOWN, false, "database error");
+        }
+        psError(PS_ERR_UNKNOWN, false, "database error");
+        psFree(query);
+        psFree(where);
+        return false;
       }
       psFree(query);
@@ -1663,11 +1682,11 @@
   // required
   PXOPT_LOOKUP_STR(minidvodb_group, config->args, "-set_minidvodb_group", true, false);
-
+  PXOPT_LOOKUP_STR(minidvodb_path,  config->args, "-set_minidvodb_path",  true, false);
+  PXOPT_LOOKUP_STR(minidvodb_host,  config->args, "-set_minidvodb_host",  true, false);
   //optional
-  PXOPT_LOOKUP_STR(minidvodb_name, config->args, "-set_minidvodb_name", false, false);
-  PXOPT_LOOKUP_STR(minidvodb_path, config->args, "-set_minidvodb_path", false, false);
-  PXOPT_LOOKUP_STR(state, config->args, "-set_state", false, false);
+  PXOPT_LOOKUP_STR(minidvodb_name,  config->args, "-set_minidvodb_name",  false, false);
+  PXOPT_LOOKUP_STR(state,           config->args, "-set_state",           false, false);
+  PXOPT_LOOKUP_STR(note,            config->args, "-set_note",            false, false);
  
-
   if (!psDBTransaction(config->dbh)) {
     psError(PS_ERR_UNKNOWN, false, "database error");
@@ -1675,22 +1694,24 @@
   }
 
-  psString minidvodbpath = "NULL";
+//  psString minidvodbpath = "NULL";
 
   // I don't know how to get around the complaints of minidvodb_path can't be null. this 'fixes' it, but someone smarter can fix it properly.
-  if (minidvodb_path) {
-    minidvodbpath = minidvodb_path;
-  } else {
-    psError(PS_ERR_UNKNOWN, false, "require minidvodb_path");
-    return false;
-  }
+//  if (minidvodb_path) {
+//    minidvodbpath = minidvodb_path;
+//  } else {
+//    psError(PS_ERR_UNKNOWN, false, "require minidvodb_path");
+//    return false;
+//  }
   
   if (!minidvodbRunInsert(config->dbh,
-			  0, // job_id
-			  minidvodb_name,
-			  minidvodb_group,
-			  minidvodbpath,
-			  "new",
-			  0
-			  )) {
+                          0, // job_id
+                          minidvodb_name,
+                          minidvodb_group,
+                          minidvodb_path,
+                          minidvodb_host,
+                          "new",
+                          note,
+                          0
+                          )) {
     psError(PS_ERR_UNKNOWN, false, "database error");
     return false;
@@ -1746,4 +1767,5 @@
     PXOPT_LOOKUP_STR(minidvodb_name,  config->args, "-set_minidvodb_name", false, false);
     PXOPT_LOOKUP_STR(minidvodb_path,  config->args, "-set_minidvodb_path", false, false);
+    PXOPT_LOOKUP_STR(minidvodb_host,  config->args, "-set_minidvodb_host", false, false);
     PXOPT_LOOKUP_STR(state,  config->args, "-set_state", false, false);
     PXOPT_LOOKUP_STR(minidvodb_group,  config->args, "-set_minidvodb_group", false, false);
@@ -1766,8 +1788,17 @@
     if (minidvodb_path) {
       if (cnt) {
-	psStringAppend(&query, "%s", comma);
+        psStringAppend(&query, "%s", comma);
       }
       
       psStringAppend(&query, " minidvodb_path = '%s'", minidvodb_path);
+      cnt++;
+    }
+
+    if (minidvodb_host) {
+      if (cnt) {
+        psStringAppend(&query, "%s", comma);
+      }
+      
+      psStringAppend(&query, " minidvodb_host = '%s'", minidvodb_host);
       cnt++;
     }
@@ -2115,11 +2146,11 @@
   psFree(output);
   minidvodbProcessedRow *row = minidvodbProcessedRowAlloc(
-							  pendingRow->minidvodb_id,
-							  dtime_resort,
-							  dtime_relphot,
-							  dtime_script,
-							  epoch,
-							  fault
-							  );
+                                                          pendingRow->minidvodb_id,
+                                                          dtime_resort,
+                                                          dtime_relphot,
+                                                          dtime_script,
+                                                          epoch,
+                                                          fault
+                                                          );
   
   if (!minidvodbProcessedInsertObject(config->dbh, row)) {
Index: branches/ccl_branches/ipponly-20191108/ippTools/src/addtoolConfig.c
===================================================================
--- branches/ccl_branches/ipponly-20191108/ippTools/src/addtoolConfig.c	(revision 41104)
+++ branches/ccl_branches/ipponly-20191108/ippTools/src/addtoolConfig.c	(revision 41211)
@@ -49,62 +49,63 @@
     // -definebyquery
     psMetadata *definebyqueryArgs = psMetadataAlloc();
-    psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-stage",             0, "set the stage (required)", NULL);
-    psMetadataAddS64(definebyqueryArgs, PS_LIST_TAIL, "-cam_id",             0, "search by cam_id", 0);
-    psMetadataAddS64(definebyqueryArgs, PS_LIST_TAIL, "-stack_id",             0, "search by stack_id", 0);
-    psMetadataAddS64(definebyqueryArgs, PS_LIST_TAIL, "-sky_id",             0, "search by sky_id", 0);
-    psMetadataAddS64(definebyqueryArgs, PS_LIST_TAIL, "-skycal_id",          0, "search by skycal_id", 0);
+    psMetadataAddStr(definebyqueryArgs,  PS_LIST_TAIL,  "-stage",         0, "set the stage (required)", NULL);
+    psMetadataAddS64(definebyqueryArgs,  PS_LIST_TAIL,  "-cam_id",        0, "search by cam_id", 0);
+    psMetadataAddS64(definebyqueryArgs,  PS_LIST_TAIL,  "-stack_id",      0, "search by stack_id", 0);
+    psMetadataAddS64(definebyqueryArgs,  PS_LIST_TAIL,  "-sky_id",        0, "search by sky_id", 0);
+    psMetadataAddS64(definebyqueryArgs,  PS_LIST_TAIL,  "-skycal_id",     0, "search by skycal_id", 0);
     pxcamSetSearchArgs(definebyqueryArgs);
-    psMetadataAddS64(definebyqueryArgs, PS_LIST_TAIL, "-diff_id",            0, "search by diff_id", 0);
-    psMetadataAddS64(definebyqueryArgs, PS_LIST_TAIL, "-ff_id",              0, "search by ff_id", 0);
-    psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search by camRun label", NULL);
-    psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-data_group", PS_META_DUPLICATE_OK, "search by camRun data_group", NULL);
-    psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-filter", PS_META_DUPLICATE_OK, "search by filter", NULL);
-    psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-reduction",          0, "search by camRun reduction class", NULL);
-    psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-destreaked",           0, "queue destreaked runs", false);
-    psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-uncensored",           0, "queue uncensored runs", false);
-    psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-set_workdir",        0, "define workdir", NULL);
-    psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-set_label",          0, "define label", NULL);
-    psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-set_reduction",      0, "define reduction class", NULL);
-    psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-set_dvodb",          0, "define DVO db", NULL);
-    psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-image_only",        0, "addstar image metadata but not detections", false);
-    psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-pretend",           0, "do not actually modify the database", false);
-    psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-simple",            0, "use the simple output format", false);
-    psMetadataAddU64(definebyqueryArgs, PS_LIST_TAIL, "-limit",              0, "limit result set to N items", 0);
-
-    psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-set_minidvodb",            0, "use minidvodb", false);
-    psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-set_minidvodb_group", 0,   "define minidvodb_group", NULL);
-    psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-set_minidvodb_name", 0,   "define minidvodb_bname", NULL);
-    psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-set_data_group", 0,   "define new data_group", NULL);
-    psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-set_dist_group", 0,   "define new dist_group", NULL);
-    psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-set_note", 0,         "define new note", NULL);
-
-    psMetadataAddF32(definebyqueryArgs, PS_LIST_TAIL, "-set_minra", 0,         "min ra for query", 0);
-    psMetadataAddF32(definebyqueryArgs, PS_LIST_TAIL, "-set_maxra", 0,         "max ra for query", 360);
-    psMetadataAddF32(definebyqueryArgs, PS_LIST_TAIL, "-set_mindec", 0,         "min dec for query", -90);
-    psMetadataAddF32(definebyqueryArgs, PS_LIST_TAIL, "-set_maxdec", 0,         "max dec for query", 90);
+    psMetadataAddS64(definebyqueryArgs,  PS_LIST_TAIL,  "-diff_id",       0, "search by diff_id", 0);
+    psMetadataAddS64(definebyqueryArgs,  PS_LIST_TAIL,  "-ff_id",         0, "search by ff_id", 0);
+    psMetadataAddStr(definebyqueryArgs,  PS_LIST_TAIL,  "-label",      PS_META_DUPLICATE_OK, "search by camRun label", NULL);
+    psMetadataAddStr(definebyqueryArgs,  PS_LIST_TAIL,  "-data_group", PS_META_DUPLICATE_OK, "search by camRun data_group", NULL);
+    psMetadataAddStr(definebyqueryArgs,  PS_LIST_TAIL,  "-filter",     PS_META_DUPLICATE_OK, "search by filter", NULL);
+    psMetadataAddStr(definebyqueryArgs,  PS_LIST_TAIL,  "-reduction",     0, "search by camRun reduction class", NULL);
+    psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-destreaked",    0, "queue destreaked runs", false);
+    psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-uncensored",    0, "queue uncensored runs", false);
+    psMetadataAddStr(definebyqueryArgs,  PS_LIST_TAIL,  "-set_workdir",   0, "define workdir", NULL);
+    psMetadataAddStr(definebyqueryArgs,  PS_LIST_TAIL,  "-set_label",     0, "define label", NULL);
+    psMetadataAddStr(definebyqueryArgs,  PS_LIST_TAIL,  "-set_reduction", 0, "define reduction class", NULL);
+    psMetadataAddStr(definebyqueryArgs,  PS_LIST_TAIL,  "-set_dvodb",     0, "define DVO db", NULL);
+    psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-image_only",    0, "addstar image metadata but not detections", false);
+    psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-pretend",       0, "do not actually modify the database", false);
+    psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-simple",        0, "use the simple output format", false);
+    psMetadataAddU64(definebyqueryArgs,  PS_LIST_TAIL,  "-limit",         0, "limit result set to N items", 0);
+
+    psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-set_minidvodb",       0, "use minidvodb",          false);
+    psMetadataAddStr(definebyqueryArgs,  PS_LIST_TAIL, "-set_minidvodb_group", 0, "define minidvodb_group",  NULL);
+    psMetadataAddStr(definebyqueryArgs,  PS_LIST_TAIL, "-set_minidvodb_name",  0, "define minidvodb_bname",  NULL);
+    psMetadataAddStr(definebyqueryArgs,  PS_LIST_TAIL, "-set_minidvodb_host",  0, "define minidvodb_host",   NULL);
+    psMetadataAddStr(definebyqueryArgs,  PS_LIST_TAIL, "-set_data_group",      0, "define new data_group",   NULL);
+    psMetadataAddStr(definebyqueryArgs,  PS_LIST_TAIL, "-set_dist_group",      0, "define new dist_group",   NULL);
+    psMetadataAddStr(definebyqueryArgs,  PS_LIST_TAIL, "-set_note",            0, "define new note",         NULL);
+
+    psMetadataAddF32(definebyqueryArgs,  PS_LIST_TAIL,  "-set_minra",  0, "min ra for query",    0);
+    psMetadataAddF32(definebyqueryArgs,  PS_LIST_TAIL,  "-set_maxra",  0, "max ra for query",  360);
+    psMetadataAddF32(definebyqueryArgs,  PS_LIST_TAIL, "-set_mindec", 0, "min dec for query", -90);
+    psMetadataAddF32(definebyqueryArgs,  PS_LIST_TAIL, "-set_maxdec", 0, "max dec for query",  90);
 
 
     // -updaterun
     psMetadata *updaterunArgs = psMetadataAlloc();
-    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-stage",             0, "set the stage (required)", NULL);
-    psMetadataAddS64(updaterunArgs, PS_LIST_TAIL, "-add_id",                 0, "search by add_id", 0);
-    psMetadataAddS64(updaterunArgs, PS_LIST_TAIL, "-cam_id",                 0, "search by cam_id", 0);
-    psMetadataAddS64(updaterunArgs, PS_LIST_TAIL, "-stack_id",                 0, "search by stack_id", 0);
-    psMetadataAddS64(updaterunArgs, PS_LIST_TAIL, "-sky_id",                 0, "search by sky_id", 0);
-    psMetadataAddS64(updaterunArgs, PS_LIST_TAIL, "-skycal_id",                 0, "search by skycal_id", 0);
-    psMetadataAddS64(updaterunArgs, PS_LIST_TAIL, "-diff_id",                0, "search by diff_id",0);
-    psMetadataAddS64(updaterunArgs, PS_LIST_TAIL, "-ff_id",                  0, "search by _ff_id",0);
+    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL,  "-stage",          0, "set the stage (required)", NULL);
+    psMetadataAddS64(updaterunArgs, PS_LIST_TAIL,  "-add_id",         0, "search by add_id",            0);
+    psMetadataAddS64(updaterunArgs, PS_LIST_TAIL,  "-cam_id",         0, "search by cam_id",            0);
+    psMetadataAddS64(updaterunArgs, PS_LIST_TAIL,  "-stack_id",       0, "search by stack_id",          0);
+    psMetadataAddS64(updaterunArgs, PS_LIST_TAIL,  "-sky_id",         0, "search by sky_id",            0);
+    psMetadataAddS64(updaterunArgs, PS_LIST_TAIL,  "-skycal_id",      0, "search by skycal_id",         0);
+    psMetadataAddS64(updaterunArgs, PS_LIST_TAIL,  "-diff_id",        0, "search by diff_id",           0);
+    psMetadataAddS64(updaterunArgs, PS_LIST_TAIL,  "-ff_id",          0, "search by _ff_id",            0);
     pxcamSetSearchArgs(updaterunArgs);
-    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-label",                  0, "search by addRun label", NULL);
-    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-state",                  0, "search by addRun state", NULL);
-    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-reduction",              0, "search by addRun reduction class", NULL);
-    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-dvodb",                  0, "search by dvodb", NULL);
-    psMetadataAddBool(updaterunArgs, PS_LIST_TAIL, "-all",                   0, "allow everything to be queued without search terms", false);
-    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_state",              0, "set state", NULL);
-    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_label",              0, "set label", NULL);
-    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_dvodb",              0, "set dvodb", NULL);
-    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_data_group", 0,   "define new data_group", NULL);
-    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_dist_group", 0,   "define new dist_group", NULL);
-    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_note", 0,         "define new note", NULL);
+    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL,  "-label",          0, "search by addRun label",           NULL);
+    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL,  "-state",          0, "search by addRun state",           NULL);
+    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL,  "-reduction",      0, "search by addRun reduction class", NULL);
+    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL,  "-dvodb",          0, "search by dvodb",                  NULL);
+    psMetadataAddBool(updaterunArgs, PS_LIST_TAIL, "-all",            0, "allow everything to be queued without search terms", false);
+    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL,  "-set_state",      0, "set state",             NULL);
+    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL,  "-set_label",      0, "set label",             NULL);
+//    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL,  "-set_dvodb",      0, "set dvodb",             NULL);
+    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL,  "-set_data_group", 0, "define new data_group", NULL);
+    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL,  "-set_dist_group", 0, "define new dist_group", NULL);
+    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL,  "-set_note",       0, "define new note",       NULL);
 
     // -pendingexp
@@ -129,16 +130,17 @@
     // -addprocessedexp
     psMetadata *addprocessedexpArgs = psMetadataAlloc();
-    psMetadataAddS64(addprocessedexpArgs, PS_LIST_TAIL, "-add_id", 0,            "define addtool ID (required)", 0);
-    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-path_base", 0,            "define base output location", NULL);
-     psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-dvodb_path", 0,            "define base output location", NULL);
-      psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-minidvodb_name", 0,            "define minidvodb_name", NULL);
-    psMetadataAddF32(addprocessedexpArgs, PS_LIST_TAIL, "-dtime_addstar", 0, "define elapsed time for DVO insertion (seconds)", NAN);
-    psMetadataAddS16(addprocessedexpArgs, PS_LIST_TAIL, "-fault",  0,            "set fault code", 0);
-    psMetadataAddS64(addprocessedexpArgs, PS_LIST_TAIL, "-stage_extra1",  0,            "set stage_extra1", 0);
-    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-stage_extra1_list",  0, "restrict multiadd ops to a set of stage_extra1 values", 0);
-    psMetadataAddS64(addprocessedexpArgs, PS_LIST_TAIL, "-stage_id",  0,            "set stage_id", 0);
-    psMetadataAddBool(addprocessedexpArgs, PS_LIST_TAIL, "-multiadd",           0, "for addstar multi mode, group by stage_id ", false);
-    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-multiaddlabel", 0,            "label for multiadd", NULL);
-    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-stage", 0,            "select stage", NULL);
+    psMetadataAddS64(addprocessedexpArgs, PS_LIST_TAIL, "-add_id",            0, "define addtool ID (required)",   0);
+    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-path_base",         0, "define base output location", NULL);
+    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-dvodb_path",        0, "define base output location", NULL);
+    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-minidvodb_name",    0, "define minidvodb_name", NULL);
+    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-minidvodb_host",    0, "define minidvodb_name", NULL);
+    psMetadataAddF32(addprocessedexpArgs, PS_LIST_TAIL, "-dtime_addstar",     0, "define elapsed time for DVO insertion (seconds)", NAN);
+    psMetadataAddS16(addprocessedexpArgs, PS_LIST_TAIL, "-fault",             0, "set fault code", 0);
+    psMetadataAddS64(addprocessedexpArgs, PS_LIST_TAIL, "-stage_extra1",      0, "set stage_extra1", 0);
+    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-stage_extra1_list", 0, "restrict multiadd ops to a set of stage_extra1 values", 0);
+    psMetadataAddS64(addprocessedexpArgs, PS_LIST_TAIL, "-stage_id",          0, "set stage_id", 0);
+    psMetadataAddBool(addprocessedexpArgs, PS_LIST_TAIL, "-multiadd",         0, "for addstar multi mode, group by stage_id ", false);
+    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-multiaddlabel",     0, "label for multiadd", NULL);
+    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-stage",             0, "select stage", NULL);
     // -processedexp
     psMetadata *processedexpArgs = psMetadataAlloc();
@@ -187,29 +189,32 @@
     // -addminidvodbruns
     psMetadata *addminidvodbrunArgs = psMetadataAlloc();
-    psMetadataAddStr(addminidvodbrunArgs, PS_LIST_TAIL, "-set_minidvodb_name",        0, "define minidvodb_name", NULL);
-    psMetadataAddStr(addminidvodbrunArgs, PS_LIST_TAIL, "-set_minidvodb_group",        0, "define minidvodb_group (required)", NULL);
-    psMetadataAddStr(addminidvodbrunArgs, PS_LIST_TAIL, "-set_minidvodb_path",        0, "define path for minidvodb", NULL);
-    psMetadataAddStr(addminidvodbrunArgs, PS_LIST_TAIL, "-set_state",        0, "define state", NULL);
+    psMetadataAddStr(addminidvodbrunArgs, PS_LIST_TAIL, "-set_minidvodb_name",  0, "define minidvodb_name",                NULL);
+    psMetadataAddStr(addminidvodbrunArgs, PS_LIST_TAIL, "-set_minidvodb_group", 0, "define minidvodb_group (required)",    NULL);
+    psMetadataAddStr(addminidvodbrunArgs, PS_LIST_TAIL, "-set_minidvodb_path",  0, "define path for minidvodb (required)", NULL);
+    psMetadataAddStr(addminidvodbrunArgs, PS_LIST_TAIL, "-set_minidvodb_host",  0, "define host for minidvodb (required)", NULL);
+    psMetadataAddStr(addminidvodbrunArgs, PS_LIST_TAIL, "-set_state",           0, "define state",                         NULL);
+    psMetadataAddStr(addminidvodbrunArgs, PS_LIST_TAIL, "-set_note",            0, "define note",                          NULL);
 
     // -updateminidvodbruns
     psMetadata *updateminidvodbrunArgs = psMetadataAlloc();
-    psMetadataAddU64(updateminidvodbrunArgs, PS_LIST_TAIL, "-minidvodb_id",        0, "search by minidvodb_id ", 0);
-    psMetadataAddStr(updateminidvodbrunArgs, PS_LIST_TAIL, "-minidvodb_group",        0, "search by minidvodb_name (LIKE)", NULL);
-    psMetadataAddStr(updateminidvodbrunArgs, PS_LIST_TAIL, "-minidvodb_name",        0, "search by minidvodb_name (LIKE)", NULL);
-    psMetadataAddStr(updateminidvodbrunArgs, PS_LIST_TAIL, "-minidvodb_path",        0, "search by path for minidvodb", NULL);
-    psMetadataAddStr(updateminidvodbrunArgs, PS_LIST_TAIL, "-state",        0, "search by state", NULL);
-    psMetadataAddStr(updateminidvodbrunArgs, PS_LIST_TAIL, "-set_minidvodb_name",        0, "define minidvodb_name", NULL);
-    psMetadataAddStr(updateminidvodbrunArgs, PS_LIST_TAIL, "-set_minidvodb_path",        0, "define path for minidvodb", NULL);
-    psMetadataAddStr(updateminidvodbrunArgs, PS_LIST_TAIL, "-set_minidvodb_group",        0, "define path for the merged dvodb", NULL);
-    psMetadataAddStr(updateminidvodbrunArgs, PS_LIST_TAIL, "-set_state",        0, "define state", NULL);
+    psMetadataAddU64(updateminidvodbrunArgs, PS_LIST_TAIL, "-minidvodb_id",        0, "search by minidvodb_id ",             0);
+    psMetadataAddStr(updateminidvodbrunArgs, PS_LIST_TAIL, "-minidvodb_group",     0, "search by minidvodb_name (LIKE)",  NULL);
+    psMetadataAddStr(updateminidvodbrunArgs, PS_LIST_TAIL, "-minidvodb_name",      0, "search by minidvodb_name (LIKE)",  NULL);
+    psMetadataAddStr(updateminidvodbrunArgs, PS_LIST_TAIL, "-minidvodb_path",      0, "search by path for minidvodb",     NULL);
+    psMetadataAddStr(updateminidvodbrunArgs, PS_LIST_TAIL, "-state",               0, "search by state",                  NULL);
+    psMetadataAddStr(updateminidvodbrunArgs, PS_LIST_TAIL, "-set_minidvodb_name",  0, "define minidvodb_name",            NULL);
+    psMetadataAddStr(updateminidvodbrunArgs, PS_LIST_TAIL, "-set_minidvodb_group", 0, "define path for the merged dvodb", NULL);
+    psMetadataAddStr(updateminidvodbrunArgs, PS_LIST_TAIL, "-set_minidvodb_path",  0, "define path for minidvodb",        NULL);
+    psMetadataAddStr(updateminidvodbrunArgs, PS_LIST_TAIL, "-set_minidvodb_host",  0, "define host for the merged dvodb", NULL);
+    psMetadataAddStr(updateminidvodbrunArgs, PS_LIST_TAIL, "-set_state",           0, "define state",                     NULL);
     
     // -listminidvodbrunArgs
     psMetadata *listminidvodbrunArgs = psMetadataAlloc();
-    psMetadataAddU64(listminidvodbrunArgs, PS_LIST_TAIL, "-minidvodb_id",        0, "search by minidvodb_id", 0);
-    psMetadataAddStr(listminidvodbrunArgs, PS_LIST_TAIL, "-minidvodb_name",        0, "search by minidvodb_name (LIKE)", NULL);
-    psMetadataAddStr(listminidvodbrunArgs, PS_LIST_TAIL, "-minidvodb_group",     0,    "search by minidvodb.minidvodb_group", NULL);
-    psMetadataAddStr(listminidvodbrunArgs, PS_LIST_TAIL, "-state",        0, "search by state", NULL);
-    psMetadataAddU64(listminidvodbrunArgs, PS_LIST_TAIL, "-limit",        0, "limit to N items", 0);
-    psMetadataAddBool(listminidvodbrunArgs, PS_LIST_TAIL, "-simple",        0, "simple output", false);
+    psMetadataAddU64(listminidvodbrunArgs, PS_LIST_TAIL, "-minidvodb_id",    0, "search by minidvodb_id",                 0);
+    psMetadataAddStr(listminidvodbrunArgs, PS_LIST_TAIL, "-minidvodb_name",  0, "search by minidvodb_name (LIKE)",     NULL);
+    psMetadataAddStr(listminidvodbrunArgs, PS_LIST_TAIL, "-minidvodb_group", 0, "search by minidvodb.minidvodb_group", NULL);
+    psMetadataAddStr(listminidvodbrunArgs, PS_LIST_TAIL, "-state",           0, "search by state",                     NULL);
+    psMetadataAddU64(listminidvodbrunArgs, PS_LIST_TAIL, "-limit",           0, "limit to N items",                       0);
+    psMetadataAddBool(listminidvodbrunArgs, PS_LIST_TAIL, "-simple",         0, "simple output",                      false);
     
     //psMetadataAddBool(listminidvodbrunArgs, PS_LIST_TAIL, "-finished_addrun",        0, "limit to minidvodbs with completed addRuns (none in new state)", false);
Index: branches/ccl_branches/ipponly-20191108/ippTools/src/flatcorr.c
===================================================================
--- branches/ccl_branches/ipponly-20191108/ippTools/src/flatcorr.c	(revision 41104)
+++ branches/ccl_branches/ipponly-20191108/ippTools/src/flatcorr.c	(revision 41211)
@@ -676,4 +676,5 @@
 		0,  //The minidvodb stuff is off
 		NULL,
+		NULL,
 		NULL)) {
             if (!psDBRollback(config->dbh)) {
Index: branches/ccl_branches/ipponly-20191108/ippTools/src/pxadd.c
===================================================================
--- branches/ccl_branches/ipponly-20191108/ippTools/src/pxadd.c	(revision 41104)
+++ branches/ccl_branches/ipponly-20191108/ippTools/src/pxadd.c	(revision 41211)
@@ -141,5 +141,6 @@
 		       bool minidvodb,
 		       char *minidvodb_group,
-		       char *minidvodb_name)
+		       char *minidvodb_name,
+		       char *minidvodb_host)
 {
     PS_ASSERT_PTR_NON_NULL(config, false);
@@ -208,4 +209,5 @@
 			 minidvodb_group,
 			 minidvodb_name,
+			 minidvodb_host,
                          (long long) stage_id
     )) {
Index: branches/ccl_branches/ipponly-20191108/ippTools/src/pxadd.h
===================================================================
--- branches/ccl_branches/ipponly-20191108/ippTools/src/pxadd.h	(revision 41104)
+++ branches/ccl_branches/ipponly-20191108/ippTools/src/pxadd.h	(revision 41211)
@@ -43,5 +43,5 @@
 		       bool minidvodb,
 		       char *minidvodb_group,
-		       char *minidvodb_name);
-
+		       char *minidvodb_name,
+		       char *minidvodb_host);
 #endif // PXADD_H
