Index: trunk/ippTools/src/pxchip.c
===================================================================
--- trunk/ippTools/src/pxchip.c	(revision 14082)
+++ trunk/ippTools/src/pxchip.c	(revision 14091)
@@ -74,5 +74,5 @@
     // create a chipRun
     if (!chipRunInsert(config->dbh,
-            0x0,
+            0x0, // chip_id
             (psS64)atoll(exp_id),
             "run",      // state                
Index: trunk/ippTools/src/pxchip.h
===================================================================
--- trunk/ippTools/src/pxchip.h	(revision 14082)
+++ trunk/ippTools/src/pxchip.h	(revision 14091)
@@ -31,5 +31,5 @@
                          psString workdir,
                          psString label,
-                         psString recipe,
+                         psString reduction,
                          psString expgroup,
                          psString dvodb);
Index: trunk/ippTools/src/pxinject.c
===================================================================
--- trunk/ippTools/src/pxinject.c	(revision 14082)
+++ trunk/ippTools/src/pxinject.c	(revision 14091)
@@ -115,4 +115,14 @@
     if (!workdir) {
         psError(PS_ERR_UNKNOWN, true, "-workdir is required");
+        return false;
+    }
+
+    psString reduction = psMetadataLookupStr(&status, config->args, "-reduction");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -reduction");
+        return false;
+    }
+    if (!reduction) {
+        psError(PS_ERR_UNKNOWN, true, "-reduction is required");
         return false;
     }
@@ -125,5 +135,6 @@
                 "reg", // state
                 workdir,
-                "dirty"
+                "dirty",
+                reduction
             )
         ) {
Index: trunk/ippTools/src/pxinjectConfig.c
===================================================================
--- trunk/ippTools/src/pxinjectConfig.c	(revision 14082)
+++ trunk/ippTools/src/pxinjectConfig.c	(revision 14091)
@@ -53,4 +53,6 @@
     psMetadataAddStr(newExpArgs, PS_LIST_TAIL, "-workdir",  0,
             "define workdir (required)", 0);
+    psMetadataAddStr(newExpArgs, PS_LIST_TAIL, "-reduction",  0,
+            "define reduction class (required)", 0);
     psMetadataAddBool(newExpArgs, PS_LIST_TAIL, "-simple",  0,
             "use the simple output format", false);
Index: trunk/ippTools/src/regtool.c
===================================================================
--- trunk/ippTools/src/regtool.c	(revision 14082)
+++ trunk/ippTools/src/regtool.c	(revision 14091)
@@ -629,5 +629,4 @@
             return false;
         }
-        psFree(rawExp);
 
         // if this is a detrend image don't put it in the chip queue (and we're
@@ -641,4 +640,5 @@
                 }
                 psError(PS_ERR_UNKNOWN, false, "failed to change newExp.state for exp_id: %s", exp_id);
+                psFree(rawExp);
                 psFree(output);
                 return false;
@@ -655,4 +655,5 @@
             }
             psError(PS_ERR_UNKNOWN, false, "failed to change newExp.state for exp_id: %s", exp_id);
+            psFree(rawExp);
             psFree(output);
             return false;
@@ -661,5 +662,12 @@
         // insert an entry into the chipPendingExp table
         // this can only be run as the newExp's state has been set to stop
-        if (!pxchipQueueByExpTag(config, exp_id, NULL, NULL, NULL, NULL, NULL)) {
+        if (!pxchipQueueByExpTag(config,
+                    exp_id, // exp_id is the string version, rawExp->exp_id isa int
+                    rawExp->workdir,
+                    NULL, // label
+                    rawExp->reduction,
+                    NULL, // expgroup
+                    NULL  // dvodb
+        )) {
             // rollback
             if (!psDBRollback(config->dbh)) {
@@ -667,7 +675,9 @@
             }
             psError(PS_ERR_UNKNOWN, false, "failed to queue chipPendingExp");
+            psFree(rawExp);
             psFree(output);
             return false;
         }
+        psFree(rawExp);
     }
     psFree(output);
@@ -924,4 +934,16 @@
     }
 
+    psString workdir = psMetadataLookupStr(&status, config->args, "-workdir");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -workdir");
+        return false;
+    }
+
+    psString reduction = psMetadataLookupStr(&status, config->args, "-reduction");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -reduction");
+        return false;
+    }
+
     psString filter = psMetadataLookupStr(&status, config->args, "-filter");
     if (!status) {
@@ -1065,5 +1087,6 @@
         exp_type,
         filelevel,
-        exp->workdir,
+        workdir ? workdir : exp->workdir,
+        reduction ? reduction : exp->reduction,
         filter,
         airmass,
Index: trunk/ippTools/src/regtoolConfig.c
===================================================================
--- trunk/ippTools/src/regtoolConfig.c	(revision 14082)
+++ trunk/ippTools/src/regtoolConfig.c	(revision 14091)
@@ -176,6 +176,8 @@
     psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-filelevel",  0,
         "define the data partitioning level of this file", NULL);
-    psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-workdir",  0,
+    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-workdir",  0,
         "define the \"default\" workdir for this exposure", NULL);
+    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-reduction",  0,
+        "define the \"default\" reduction class for this exposure", NULL);
     psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-filter",  0,
         "define filter ", NULL);
