Index: /trunk/ippTools/Makefile.am
===================================================================
--- /trunk/ippTools/Makefile.am	(revision 9056)
+++ /trunk/ippTools/Makefile.am	(revision 9057)
@@ -2,2 +2,4 @@
 
 CLEANFILES = *~ core core.*
+
+ACLOCAL_AMFLAGS = -I m4
Index: /trunk/ippTools/configure.ac
===================================================================
--- /trunk/ippTools/configure.ac	(revision 9056)
+++ /trunk/ippTools/configure.ac	(revision 9057)
@@ -16,5 +16,5 @@
 PKG_CHECK_MODULES([PSLIB], [pslib >= 0.12.99]) 
 PKG_CHECK_MODULES([PSMODULES], [psmodules >= 0.12.0]) 
-PKG_CHECK_MODULES([IPPDB], [ippdb >= 0.0.37]) 
+PKG_CHECK_MODULES([IPPDB], [ippdb >= 0.0.38]) 
 
 AC_PROG_PERL_MODULES(
Index: /trunk/ippTools/scripts/dettest.sh
===================================================================
--- /trunk/ippTools/scripts/dettest.sh	(revision 9056)
+++ /trunk/ippTools/scripts/dettest.sh	(revision 9057)
@@ -9,9 +9,9 @@
 
 for ID in `seq 0 3` ; do
-    dettool -addprocessed -det_id 1 -exp_id 10 -class_id $ID -uri file://proc-$ID -recip myrecip -bg 1 -bg_stdev 1 -bg_mean_stdev 1 || exit 1
+    dettool -addprocessedimfile -det_id 1 -exp_tag t10 -class_id $ID -uri file://proc-$ID -recip myrecip -bg 1 -bg_stdev 1 -bg_mean_stdev 1 || exit 1
 done;
 
 for ID in `seq 0 3` ; do
-    dettool -addprocessed -det_id 1 -exp_id 11 -class_id $ID -uri file://proc-$ID -recip myrecip -bg 1 -bg_stdev 1 -bg_mean_stdev 1 || exit 1
+    dettool -addprocessedimfile -det_id 1 -exp_tag t11 -class_id $ID -uri file://proc-$ID -recip myrecip -bg 1 -bg_stdev 1 -bg_mean_stdev 1 || exit 1
 done;
 
@@ -34,19 +34,19 @@
 
 for ID in `seq 0 3` ; do
-    dettool -addresidimfile -det_id 1 -exp_id 10 -class_id $ID -recip myrecip -bg 1 -bg_stdev 1 -bg_mean_stdev 1 -uri file://resid-$ID || exit 1
+    dettool -addresidimfile -det_id 1 -exp_tag t10 -class_id $ID -recip myrecip -bg 1 -bg_stdev 1 -bg_mean_stdev 1 -uri file://resid-$ID || exit 1
 done;
 for ID in `seq 0 3` ; do
-    dettool -addresidimfile -det_id 1 -exp_id 11 -class_id $ID -recip myrecip -bg 1 -bg_stdev 1 -bg_mean_stdev 1 -uri file://resid-$ID || exit 1
+    dettool -addresidimfile -det_id 1 -exp_tag t11 -class_id $ID -recip myrecip -bg 1 -bg_stdev 1 -bg_mean_stdev 1 -uri file://resid-$ID || exit 1
 done;
 
 dettool -toresidexp || exit 1
-dettool -addresidexp -det_id 1 -exp_id 10 -recip myrecipe -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -b1_uri jpeg1 -b2_uri jpeg2  || exit 1
-dettool -addresidexp -det_id 1 -exp_id 11 -recip myrecipe -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -b1_uri jpeg1 -b2_uri jpeg2  -reject || exit 1
+dettool -addresidexp -det_id 1 -exp_tag t10 -recip myrecipe -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -b1_uri jpeg1 -b2_uri jpeg2  || exit 1
+dettool -addresidexp -det_id 1 -exp_tag t11 -recip myrecipe -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -b1_uri jpeg1 -b2_uri jpeg2  -reject || exit 1
 
 dettool -residdetrun || exit 1
 dettool -residexp || exit 1
 dettool -updateresidexp -det_id 1 -iteration 0 -recip yourrecipe || exit 1
-dettool -updateresidexp -det_id 1 -iteration 0 -exp_id 10 -reject || exit 1
-dettool -updateresidexp -det_id 1 -iteration 0 -exp_id 11 || exit 1
+dettool -updateresidexp -det_id 1 -iteration 0 -exp_tag t10 -reject || exit 1
+dettool -updateresidexp -det_id 1 -iteration 0 -exp_tag t11 || exit 1
 dettool -residexp || exit 1
 dettool -updatedetrun -det_id 1 -again || exit 1
Index: /trunk/ippTools/scripts/regtest.sh
===================================================================
--- /trunk/ippTools/scripts/regtest.sh	(revision 9056)
+++ /trunk/ippTools/scripts/regtest.sh	(revision 9057)
@@ -8,25 +8,25 @@
 echo -e "YES\nipp\n\n" | pxadmin -recreate || exit 1
 
-$inject -newExp -exp_id 10 -inst gpc -telescope ps1 -exp_type object -imfiles 4 || exit 1
+$inject -newExp -exp_tag t10 -exp_id 10 -inst gpc -telescope ps1 -exp_type object -imfiles 4 || exit 1
 
 for ID in `seq 0 3`; do
-    $inject -newImfile -exp_id 10 -class OTA -class_id $ID -uri file://$ID || exit 1
+    $inject -newImfile -exp_tag t10 -class OTA -class_id $ID -uri file://$ID || exit 1
 done;
 
-$inject -newExp -exp_id 11 -inst gpc -telescope ps1 -exp_type object -imfiles 4 || exit 1
+$inject -newExp -exp_tag t11 -exp_id 11 -inst gpc -telescope ps1 -exp_type object -imfiles 4 || exit 1
 
 for ID in `seq 0 3`; do
-    $inject -newImfile -exp_id 11 -class OTA -class_id $ID -uri file://$ID || exit 1
+    $inject -newImfile -exp_tag t11 -class OTA -class_id $ID -uri file://$ID || exit 1
 done;
 
 for ID in `seq 0 3`; do
-    $p0tool -updateimfile -exp_id 10 -exp_type object -class OTA -class_id $ID -filter r -airmass 10 -ra 1 -decl 2 -exp_time 0 -bg 1 -bg_stdev 1 -bg_mean_stdev 10 -alt 10 -az 10 -ccd_temp 10 -posang 10 || exit 1
+    $p0tool -updateimfile -exp_tag t10 -exp_type object -class OTA -class_id $ID -filter r -airmass 10 -ra 1 -decl 2 -exp_time 0 -bg 1 -bg_stdev 1 -bg_mean_stdev 10 -alt 10 -az 10 -ccd_temp 10 -posang 10 || exit 1
 done;
 
-$p0tool -updateexp -exp_id 10 -filter r -airmass 10 -ra 1 -decl 2 -exp_type bias -exp_time 0 -bg 10 -bg_stdev 1 -bg_mean_stdev 10 -alt 10 -az 10 -ccd_temp 45 -posang 10 $* || exit 1
+$p0tool -updateexp -exp_tag t10 -filter r -airmass 10 -ra 1 -decl 2 -exp_type bias -exp_time 0 -bg 10 -bg_stdev 1 -bg_mean_stdev 10 -alt 10 -az 10 -ccd_temp 45 -posang 10 $* || exit 1
 
 for ID in `seq 0 3`; do
-    $p0tool -updateimfile -exp_id 11 -exp_type object -class OTA -class_id $ID -filter r -airmass 10 -ra 1 -decl 2 -exp_time 0 -bg 1 -bg_stdev 1 -bg_mean_stdev 10 -alt 10 -az 10 -ccd_temp 10 -posang 10 || exit 1
+    $p0tool -updateimfile -exp_tag t11 -exp_type object -class OTA -class_id $ID -filter r -airmass 10 -ra 1 -decl 2 -exp_time 0 -bg 1 -bg_stdev 1 -bg_mean_stdev 10 -alt 10 -az 10 -ccd_temp 10 -posang 10 || exit 1
 done;
 
-$p0tool -updateexp -exp_id 11 -filter r -airmass 11 -ra 1 -decl 2 -exp_type bias -exp_time 0 -bg 11 -bg_stdev 1 -bg_mean_stdev 11 -alt 11 -az 11 -ccd_temp 45 -posang 11 $* || exit 1
+$p0tool -updateexp -exp_tag t11 -filter r -airmass 11 -ra 1 -decl 2 -exp_type bias -exp_time 0 -bg 11 -bg_stdev 1 -bg_mean_stdev 11 -alt 11 -az 11 -ccd_temp 45 -posang 11 $* || exit 1
Index: /trunk/ippTools/src/chiptool.c
===================================================================
--- /trunk/ippTools/src/chiptool.c	(revision 9056)
+++ /trunk/ippTools/src/chiptool.c	(revision 9057)
@@ -92,6 +92,6 @@
             for (long j = 0; j < pendingFrames->n; j++) {
                 p2PendingFrame *pendingFrame = pendingFrames->data[j];
-                if (strcmp(rawFrame->exposure->exp_id,
-                           pendingFrame->exposure->exp_id) == 0) {
+                if (strcmp(rawFrame->exposure->exp_tag,
+                           pendingFrame->exposure->exp_tag) == 0) {
                     psArrayRemove(rawFrames, rawFrame);
                     // dec the counter as the array just got shorter
@@ -111,6 +111,6 @@
                 for (long j = 0; j < pendingFrames->n; j++) {
                     p2DoneFrame *doneFrame = pendingFrames->data[j];
-                    if (strcmp(rawFrame->exposure->exp_id,
-                               doneFrame->exposure->exp_id) == 0) {
+                    if (strcmp(rawFrame->exposure->exp_tag,
+                               doneFrame->exposure->exp_tag) == 0) {
                         psArrayRemove(rawFrames, rawFrame);
                         // dec the counter as the array just got shorter
@@ -178,5 +178,5 @@
     // select * from p2ProcessedImfiles
     // where
-    // exp_id & class_id are not in p2PendingImfile
+    // exp_tag & class_id are not in p2PendingImfile
 
     // add the completed imfile to
@@ -193,7 +193,7 @@
         " FROM p2PendingImfile "
         " LEFT JOIN p2ProcessedImfile"
-        "   USING(exp_id, class_id)"
+        "   USING(exp_tag, class_id)"
         " WHERE"
-        "  p2ProcessedImfile.exp_id IS NULL"
+        "  p2ProcessedImfile.exp_tag IS NULL"
         "  AND p2ProcessedImfile.class_id IS NULL"
         );
@@ -201,12 +201,12 @@
         psMetadata *where = psMetadataAlloc();
         bool status = false;
-        psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");        if (!status) {
-            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
+        psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");        if (!status) {
+            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
             psFree(query);
             return false;
         }
-        if (exp_id) {
-            if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==", exp_id)) {
-                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
+        if (exp_tag) {
+            if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", exp_tag)) {
+                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
                 psFree(where);
                 psFree(query);
@@ -339,6 +339,6 @@
 
     // select * from p2PendingExp
-    // where exp_id is not in p2ProcessedExp
-    // where exp_id is not in p2PendingImfile
+    // where exp_tag is not in p2ProcessedExp
+    // where exp_tag is not in p2PendingImfile
     // where the number of entries in p2ProccessedImfile matches the .imfiles
     // entry in rawScienceExp
@@ -350,17 +350,17 @@
         " FROM p2PendingExp"
         " JOIN rawScienceExp"
-        "   ON p2PendingExp.exp_id = rawScienceExp.exp_id"
+        "   ON p2PendingExp.exp_tag = rawScienceExp.exp_tag"
         " LEFT JOIN p2ProcessedExp"
-        "   ON p2PendingExp.exp_id = p2ProcessedExp.exp_id"
+        "   ON p2PendingExp.exp_tag = p2ProcessedExp.exp_tag"
         " LEFT JOIN p2PendingImfile"
-        "   ON p2PendingExp.exp_id = p2PendingImfile.exp_id"
+        "   ON p2PendingExp.exp_tag = p2PendingImfile.exp_tag"
         " LEFT JOIN p2ProcessedImfile"
-        "   ON p2PendingExp.exp_id = p2ProcessedImfile.exp_id"
+        "   ON p2PendingExp.exp_tag = p2ProcessedImfile.exp_tag"
         " WHERE"
-        "  p2ProcessedExp.exp_id IS NULL"
-        "  AND p2PendingImfile.exp_id IS NULL"
-        "  AND p2ProcessedImfile.exp_id IS NOT NULL"
+        "  p2ProcessedExp.exp_tag IS NULL"
+        "  AND p2PendingImfile.exp_tag IS NULL"
+        "  AND p2ProcessedImfile.exp_tag IS NOT NULL"
         " GROUP BY"
-        "   p2PendingExp.exp_id"
+        "   p2PendingExp.exp_tag"
         " HAVING rawScienceExp.imfiles = COUNT(p2ProcessedImfile.class_id)"
         );
@@ -514,5 +514,5 @@
 
     return p2ProcessedImfileRowAlloc(
-        imfile->exp_id,
+        imfile->exp_tag,
         imfile->class_id,
         uri,
@@ -533,5 +533,5 @@
 
     return p2ProcessedExpRowAlloc(
-        pendingExp->exp_id,
+        pendingExp->exp_tag,
         pendingExp->p1_version,
         pendingExp->p2_version
@@ -544,5 +544,5 @@
 
     return p3PendingExpRowAlloc(
-        pendingExp->exp_id,
+        pendingExp->exp_tag,
         pendingExp->p1_version,
         pendingExp->p2_version
Index: /trunk/ippTools/src/chiptoolConfig.c
===================================================================
--- /trunk/ippTools/src/chiptoolConfig.c	(revision 9056)
+++ /trunk/ippTools/src/chiptoolConfig.c	(revision 9057)
@@ -32,5 +32,5 @@
     psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-filter",  0,
             "define filter of interest", NULL); 
-    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-exp_id",  0,
+    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
             "define exposure ID", NULL);
     psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-class",  0,
@@ -45,6 +45,6 @@
     // -addprocessedimfile
     psMetadata *addprocessedimfileArgs = psMetadataAlloc();
-    psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-exp_id",  0,
-            "define exp_id (required)", NULL); 
+    psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
+            "define exp_tag (required)", NULL); 
     psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-class_id",  0,
             "define class ID", NULL);
@@ -138,5 +138,5 @@
     config->where = psMetadataAlloc();
 
-    addWhereStr(exp_id);
+    addWhereStr(exp_tag);
     // convert '-inst' to 'camera'
     {
Index: /trunk/ippTools/src/dettool.c
===================================================================
--- /trunk/ippTools/src/dettool.c	(revision 9056)
+++ /trunk/ippTools/src/dettool.c	(revision 9057)
@@ -127,6 +127,6 @@
 
      psString query = psStringCopy("SELECT rawDetrendExp.* FROM rawDetrendExp"
-        " LEFT JOIN detInputExp ON rawDetrendExp.exp_id = detInputExp.exp_id"
-        " WHERE detInputExp.exp_id IS NULL");
+        " LEFT JOIN detInputExp ON rawDetrendExp.exp_tag = detInputExp.exp_tag"
+        " WHERE detInputExp.exp_tag IS NULL");
 
     if (config->where) {
@@ -190,14 +190,14 @@
     }
 
-    // we have to support multipe exp_ids
-    psMetadataItem *item = psMetadataLookup(config->args, "-exp_id");
+    // we have to support multipe exp_tags
+    psMetadataItem *item = psMetadataLookup(config->args, "-exp_tag");
     if (!item) {
         // this shouldn't actually happen when using psArgs
-        psError(PS_ERR_UNKNOWN, true, "-exp_id is required");
+        psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
         return false;
     }
     psMetadata *where = psMetadataAlloc();
 
-    // make sure that -exp_id was parsed correctly
+    // make sure that -exp_tag was parsed correctly
     // XXX this can be removed someday
     if (item->type == PS_DATA_METADATA_MULTI) {
@@ -205,17 +205,17 @@
         psMetadataItem *mItem = NULL;
         while ((mItem = psListGetAndIncrement(iter))) {
-            psString exp_id = mItem->data.V;
-            // if exp_id is NULL then it means that -exp_id has not been
+            psString exp_tag = mItem->data.V;
+            // if exp_tag is NULL then it means that -exp_tag has not been
             // specified
-            if (!exp_id) {
+            if (!exp_tag) {
                 psError(PS_ERR_UNKNOWN, true,
-                        "at least one -exp_id is required");
+                        "at least one -exp_tag is required");
                 psFree(where);
                 return false;
             }
 
-            if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id",
-                 PS_META_DUPLICATE_OK, "==", exp_id)) {
-                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
+            if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag",
+                 PS_META_DUPLICATE_OK, "==", exp_tag)) {
+                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
                 psFree(iter);
                 psFree(where);
@@ -226,5 +226,5 @@
     } else {
         psAbort(config->argv[0],
-                "-exp_id was not parsed correctly (this should not happen");
+                "-exp_tag was not parsed correctly (this should not happen");
     }
 
@@ -234,5 +234,5 @@
     }
 
-    // check that the specified exp_ids actually exist
+    // check that the specified exp_tags actually exist
     psArray *detrendExps = rawDetrendExpSelectRowObjects(config->dbh, where, 0);
     psFree(where);
@@ -242,8 +242,8 @@
     }
 
-    // we should have one rawDetrendExp row per exp_id specified
+    // we should have one rawDetrendExp row per exp_tag specified
     if (psListLength(item->data.list) != psArrayLength(detrendExps)) {
         psAbort(config->argv[0],
-    "an -exp_id matched more then one rawDetrendExp (this should not happen");
+    "an -exp_tag matched more then one rawDetrendExp (this should not happen");
 
     }
@@ -717,5 +717,5 @@
         det_id,
         iteration,
-        rawExp->exp_id,
+        rawExp->exp_tag,
         true            // use
     );
@@ -729,5 +729,5 @@
     // select rawDetrendExp.*
     // by:
-    // exp_id
+    // exp_tag
 
     psString query = psStringCopy(
@@ -735,5 +735,5 @@
         " FROM detInputExp"
         " JOIN rawDetrendExp"
-        " USING(exp_id)"
+        " USING(exp_tag)"
         );
 
@@ -789,22 +789,22 @@
     //
     // det_id is in detInputExp
-    // exp_id is in detInputExp
+    // exp_tag is in detInputExp
     // det_id is not in detProccessedImfile
-    // exp_id is not in detProccessedImfile
+    // exp_tag is not in detProccessedImfile
     // class_is is not in detProccessedImfile
     psString query = psStringCopy(
             "SELECT detInputExp.det_id, detRun.det_type, rawImfile.*"
             " FROM rawImfile"
-            " LEFT JOIN detInputExp USING(exp_id) "
+            " LEFT JOIN detInputExp USING(exp_tag) "
             " LEFT JOIN detRun ON detInputExp.det_id = detRun.position"
             " LEFT JOIN detProcessedImfile"
                 " ON detInputExp.det_id = detProcessedImfile.det_id"
-                " AND rawImfile.exp_id = detProcessedImfile.exp_id"
+                " AND rawImfile.exp_tag = detProcessedImfile.exp_tag"
                 " AND rawImfile.class_id = detProcessedImfile.class_id"
             " WHERE"
             " detInputExp.det_id IS NOT NULL"
-            " AND detInputExp.exp_id IS NOT NULL"
+            " AND detInputExp.exp_tag IS NOT NULL"
             " AND detProcessedImfile.det_id IS NULL"
-            " AND detProcessedImfile.exp_id IS NULL"
+            " AND detProcessedImfile.exp_tag IS NULL"
             " AND detProcessedImfile.class_id IS NULL"
         );
@@ -861,5 +861,5 @@
     }
 
-    // select exp_ids from detInputExp matching det_idp
+    // select exp_tags from detInputExp matching det_idp
     // where query should be pre-generated
     psArray *detInputExp =
@@ -870,14 +870,14 @@
     }
 
-    // generate where query with just the exp_ids
-    psMetadata *where_exp_ids = psMetadataAlloc();
+    // generate where query with just the exp_tags
+    psMetadata *where_exp_tags = psMetadataAlloc();
     for (long i = 0; i < psArrayLength(detInputExp); i++) {
         detInputExpRow *row = detInputExp->data[i];
-        if (!psMetadataAddStr(where_exp_ids, PS_LIST_TAIL, "exp_id",
-                PS_META_DUPLICATE_OK, "==", row->exp_id)
+        if (!psMetadataAddStr(where_exp_tags, PS_LIST_TAIL, "exp_tag",
+                PS_META_DUPLICATE_OK, "==", row->exp_tag)
         ) {
-            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
+            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
             psFree(detInputExp);
-            psFree(where_exp_ids);
+            psFree(where_exp_tags);
             return NULL;
         }
@@ -885,8 +885,8 @@
     psFree(detInputExp);
 
-    // select rawImfiles with matching exp_ids
+    // select rawImfiles with matching exp_tags
     psArray *rawImfiles =
-        rawImfileSelectRowObjects(config->dbh, where_exp_ids, 0);
-    psFree(where_exp_ids);
+        rawImfileSelectRowObjects(config->dbh, where_exp_tags, 0);
+    psFree(where_exp_tags);
     if (!rawImfiles) {
         psError(PS_ERR_UNKNOWN, false, "no rawImfile rows found");
@@ -901,5 +901,5 @@
     PS_ASSERT_PTR_NON_NULL(config, false);
 
-    // det_id, exp_id, class_id, uri, recipe, -bg, -bg_stdev, & -bg_mean_stdev
+    // det_id, exp_tag, class_id, uri, recipe, -bg, -bg_stdev, & -bg_mean_stdev
     // are required
     bool status = false;
@@ -913,11 +913,11 @@
         return false;
     }
-    psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
-        return false;
-    }
-    if (!exp_id) {
-        psError(PS_ERR_UNKNOWN, true, "-exp_id is required");
+    psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
+        return false;
+    }
+    if (!exp_tag) {
+        psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
         return false;
     }
@@ -988,8 +988,8 @@
     }
 
-    // find the matching rawImfile by exp_id/class_id
+    // find the matching rawImfile by exp_tag/class_id
     psMetadata *where = psMetadataAlloc();
-    if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==", exp_id)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
+    if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", exp_tag)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
         psFree(where);
         return false;
@@ -1011,5 +1011,5 @@
     detProcessedImfileRow *detRow = detProcessedImfileRowAlloc(
         (psS32)atol(det_id),
-        exp_id,
+        exp_tag,
         class_id,
         uri,
@@ -1044,7 +1044,7 @@
     // by:
     // find the current iteration bassed on det_id
-    // find all exp_ids in the current det_id/iteration from detInputExp
-    // find all rawImfiles in the current exp_ids
-    // compare to detProcessedImfiles by det_id/exp_id
+    // find all exp_tags in the current det_id/iteration from detInputExp
+    // find all rawImfiles in the current exp_tags
+    // compare to detProcessedImfiles by det_id/exp_tag
     // found how many imfile there are in each class_id
     // and:
@@ -1065,8 +1065,8 @@
         "    AND detRun.iteration = detInputExp.iteration"
         " JOIN rawDetrendExp"
-        "    ON detInputExp.exp_id = rawDetrendExp.exp_id"
+        "    ON detInputExp.exp_tag = rawDetrendExp.exp_tag"
         " JOIN detProcessedImfile"
         "    ON detInputExp.det_id = detProcessedImfile.det_id"
-        "    AND detInputExp.exp_id = detProcessedImfile.exp_id"
+        "    AND detInputExp.exp_tag = detProcessedImfile.exp_tag"
         " LEFT JOIN detStackedImfile"
         "    ON detInputExp.det_id = detStackedImfile.det_id"
@@ -1074,5 +1074,5 @@
         "    AND detProcessedImfile.class_id = detStackedImfile.class_id"
         " LEFT JOIN rawImfile"
-        "    ON detInputExp.exp_id = rawImfile.exp_id"
+        "    ON detInputExp.exp_tag = rawImfile.exp_tag"
         "    AND detProcessedImfile.class_id = rawImfile.class_id"
         " WHERE"
@@ -1165,5 +1165,5 @@
         // det_id is not in detStackedImfile
         // iteration is not in detStackedImfile
-        // detProcessedImfile.exp_id is not in detStackedImfile
+        // detProcessedImfile.exp_tag is not in detStackedImfile
         // detProcessedImfile.class_id is not in detStackedImfile
         // and detInputExp.include is 1
@@ -1180,5 +1180,5 @@
             "       ON detRun.position = detInputExp.det_id"
             "       AND detRun.iteration = detInputExp.iteration"
-            "       AND detProcessedImfile.exp_id = detInputExp.exp_id"
+            "       AND detProcessedImfile.exp_tag = detInputExp.exp_tag"
             "   LEFT JOIN detStackedImfile"
             "       ON detRun.position = detStackedImfile.det_id"
@@ -1267,5 +1267,5 @@
     // remove detStackedImfiles unless -unmask
     if (!psMetadataLookupBool(&status, config->args, "-unmask")) {
-        // detStackedImfiles doesn't have an exp_id so we have to generate the
+        // detStackedImfiles doesn't have an exp_tag so we have to generate the
         // where query ourselves
         bool status = false;
@@ -1293,5 +1293,5 @@
             if (!psMetadataAddS32(where, PS_LIST_TAIL, "det_id", 0, "==",
                     (psS32)atoi(det_id))) {
-                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
+                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
                 psFree(where);
                 return false;
@@ -1582,5 +1582,5 @@
     if (!psMetadataAddS32(where, PS_LIST_TAIL, "det_id", 0, "==",
             (psS32)atoi(det_id))) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
+        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
         psFree(where);
         return false;
@@ -1794,5 +1794,5 @@
     // by:
     // find the current iteration bassed on det_id
-    // find all exp_ids in the current det_id/iteration from detInputExp
+    // find all exp_tags in the current det_id/iteration from detInputExp
     // sort to detInputExp.imfiles to find the largest value per det_id/iter
     // compare imfiles to the number of detStackedImfiles by class_id
@@ -1812,5 +1812,5 @@
         "     AND detRun.iteration = detInputExp.iteration"
         " LEFT JOIN rawDetrendExp"
-        "     ON detInputExp.exp_id = rawDetrendExp.exp_id"
+        "     ON detInputExp.exp_tag = rawDetrendExp.exp_tag"
         " LEFT JOIN detStackedImfile"
         "     ON detInputExp.det_id = detStackedImfile.det_id"
@@ -1819,5 +1819,5 @@
         "   detStackedImfile.normalize = 1"
         " GROUP BY"
-        "     rawDetrendExp.exp_id"
+        "     rawDetrendExp.exp_tag"
         " HAVING MAX(rawDetrendExp.imfiles) = COUNT(detStackedImfile.class_id)"
         );
@@ -2106,8 +2106,8 @@
         psMetadata *where = psMetadataAlloc();
         for (long i = 0; i < psArrayLength(inputExps); i++) {
-            if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id",
+            if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag",
                     PS_META_DUPLICATE_OK, "==",
-                    ((detInputExpRow *)inputExps->data[i])->exp_id)) {
-                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
+                    ((detInputExpRow *)inputExps->data[i])->exp_tag)) {
+                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
                 psFree(inputExps);
                 psFree(where);
@@ -2312,5 +2312,5 @@
         " JOIN detProcessedImfile"
         "   ON detRun.position = detProcessedImfile.det_id"
-        "   AND detInputExp.exp_id = detProcessedImfile.exp_id"
+        "   AND detInputExp.exp_tag = detProcessedImfile.exp_tag"
         " JOIN detNormalizedImfile"
         "   ON detRun.position = detNormalizedImfile.det_id"
@@ -2320,10 +2320,10 @@
         "   ON detRun.position = detResidImfile.det_id"
         "   AND detRun.iteration = detResidImfile.iteration"
-        "   AND detProcessedImfile.exp_id = detResidImfile.exp_id"
+        "   AND detProcessedImfile.exp_tag = detResidImfile.exp_tag"
         "   AND detProcessedImfile.class_id = detResidImfile.class_id"
         " WHERE"
         "   detResidImfile.det_id IS NULL"
         "   AND detResidImfile.iteration IS NULL"
-        "   AND detResidImfile.exp_id IS NULL"
+        "   AND detResidImfile.exp_tag IS NULL"
         "   AND detResidImfile.class_id IS NULL"
         " UNION"
@@ -2339,5 +2339,5 @@
         " JOIN detProcessedImfile"
         "   ON detRun.position = detProcessedImfile.det_id"
-        "   AND detInputExp.exp_id = detProcessedImfile.exp_id"
+        "   AND detInputExp.exp_tag = detProcessedImfile.exp_tag"
         " JOIN detStackedImfile"
         "   ON detRun.position = detStackedImfile.det_id"
@@ -2347,10 +2347,10 @@
         "   ON detRun.position = detResidImfile.det_id"
         "   AND detRun.iteration = detResidImfile.iteration"
-        "   AND detProcessedImfile.exp_id = detResidImfile.exp_id"
+        "   AND detProcessedImfile.exp_tag = detResidImfile.exp_tag"
         "   AND detStackedImfile.class_id = detResidImfile.class_id"
         " WHERE"
         "   detResidImfile.det_id IS NULL"
         "   AND detResidImfile.iteration IS NULL"
-        "   AND detResidImfile.exp_id IS NULL"
+        "   AND detResidImfile.exp_tag IS NULL"
         "   AND detResidImfile.class_id IS NULL"
         "   AND detStackedImfile.normalize = 0"
@@ -2571,5 +2571,5 @@
 
     // make sure that there is a coresponding entry in detNormalizedImfile
-    // and the exp_id specified is valid
+    // and the exp_tag specified is valid
     // select * from detNormalizedImfile
     // by det_id, iteration, class_id
@@ -2588,12 +2588,12 @@
         "   ON detNormalizedImfile.det_id = detResidImfile.det_id"
         "   AND detNormalizedImfile.iteration= detResidImfile.iteration"
-        "   AND detInputExp.exp_id = detResidImfile.exp_id"
+        "   AND detInputExp.exp_tag = detResidImfile.exp_tag"
         "   AND detNormalizedImfile.class_id = detResidImfile.class_id"
         " WHERE"
         "  detResidImfile.det_id IS NULL"
         "  AND detResidImfile.iteration IS NULL"
-        "  AND detResidImfile.exp_id IS NULL"
+        "  AND detResidImfile.exp_tag IS NULL"
         "  AND detResidImfile.class_id IS NULL"
-        "  AND detInputExp.exp_id = '%s'"
+        "  AND detInputExp.exp_tag = '%s'"
         " UNION"
         " SELECT"
@@ -2608,12 +2608,12 @@
         "   ON detStackedImfile.det_id = detResidImfile.det_id"
         "   AND detStackedImfile.iteration= detResidImfile.iteration"
-        "   AND detInputExp.exp_id = detResidImfile.exp_id"
+        "   AND detInputExp.exp_tag = detResidImfile.exp_tag"
         "   AND detStackedImfile.class_id = detResidImfile.class_id"
         " WHERE"
         "   detResidImfile.det_id IS NULL"
         "   AND detResidImfile.iteration IS NULL"
-        "   AND detResidImfile.exp_id IS NULL"
+        "   AND detResidImfile.exp_tag IS NULL"
         "   AND detResidImfile.class_id IS NULL"
-        "   AND detInputExp.exp_id = '%s'"
+        "   AND detInputExp.exp_tag = '%s'"
         "   AND detStackedImfile.normalize = 0"
         " ) as detNormStackedImfile"
@@ -2678,20 +2678,20 @@
     }
 
-    // exp_id is manadatory to cross check that this is a exp_id for this
+    // exp_tag is manadatory to cross check that this is a exp_tag for this
     // detRUn
     bool status = false;
-    psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
+    psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
         psFree(query);
         return false;
     }
-    if (!exp_id) {
-        psError(PS_ERR_UNKNOWN, true, "-exp_id is required");
+    if (!exp_tag) {
+        psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
         psFree(query);
         return false;
     }
 
-    if (!p_psDBRunQuery(config->dbh, query, exp_id, exp_id)) {
+    if (!p_psDBRunQuery(config->dbh, query, exp_tag, exp_tag)) {
         psError(PS_ERR_UNKNOWN, false, "database error");
         psFree(query);
@@ -2757,11 +2757,11 @@
 
     bool status = false;
-    psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
-        return false;
-    }
-    if (!exp_id) {
-        psError(PS_ERR_UNKNOWN, true, "-exp_id is required");
+    psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
+        return false;
+    }
+    if (!exp_tag) {
+        psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
         return false;
     }
@@ -2827,5 +2827,5 @@
             normalizedImfile->det_id,
             normalizedImfile->iteration,
-            exp_id,
+            exp_tag,
             normalizedImfile->class_id,
             uri,
@@ -2845,5 +2845,5 @@
     // select detResidImfile.*
     // by:
-    // where det_id, iteration, exp_id is not in detResidExp;
+    // where det_id, iteration, exp_tag is not in detResidExp;
 
     psString query = psStringCopy(
@@ -2852,9 +2852,9 @@
         " FROM detResidImfile"
         " LEFT JOIN detResidExp"
-        "   USING(det_id, iteration, exp_id)"
+        "   USING(det_id, iteration, exp_tag)"
         " WHERE"
         "   detResidExp.det_id IS NULL"
         "   AND detResidExp.iteration IS NULL"
-        "   AnD detResidExp.exp_id IS NULL"
+        "   AnD detResidExp.exp_tag IS NULL"
         );
 
@@ -2917,12 +2917,12 @@
     // select detRun.iteration
     // select detRun.det_type
-    // select detInputExp.exp_id
+    // select detInputExp.exp_tag
     // select detInputExp.include
     // by:
     // find the current iteration bassed on det_id
-    // find all exp_ids in the current det_id/iteration from detInputExp
+    // find all exp_tags in the current det_id/iteration from detInputExp
     // compare to detInputExp.imfiles to derResidImfile by class_id
     // and:
-    // detResidImfile.{det_id, iteration, exp_id} is not in detResidExp
+    // detResidImfile.{det_id, iteration, exp_tag} is not in detResidExp
 
     psString query = psStringCopy(
@@ -2931,5 +2931,5 @@
         "   iteration,"
         "   det_type,"
-        "   exp_id,"
+        "   exp_tag,"
         "   include"
         " FROM"
@@ -2938,5 +2938,5 @@
         "       detRun.iteration,"
         "       detRun.det_type,"
-        "       detInputExp.exp_id,"
+        "       detInputExp.exp_tag,"
         "       detInputExp.include,"
         "       rawDetrendExp.imfiles"
@@ -2946,19 +2946,19 @@
         "       AND detRun.iteration = detInputExp.iteration"
         "   LEFT JOIN rawDetrendExp"
-        "       ON detInputExp.exp_id = rawDetrendExp.exp_id"
+        "       ON detInputExp.exp_tag = rawDetrendExp.exp_tag"
         "   LEFT JOIN detResidImfile"
         "       ON detRun.position = detResidImfile.det_id"
         "       AND detRun.iteration = detResidImfile.iteration"
-        "       AND detInputExp.exp_id = detResidImfile.exp_id"
+        "       AND detInputExp.exp_tag = detResidImfile.exp_tag"
         "   LEFT JOIN detResidExp"
         "       ON detRun.position = detResidExp.det_id"
         "       AND detRun.iteration = detResidExp.iteration"
-        "       AND detInputExp.exp_id = detResidExp.exp_id"
+        "       AND detInputExp.exp_tag = detResidExp.exp_tag"
         "   WHERE"
         "       detResidExp.det_id IS NULL"
         "       AND detResidExp.iteration IS NULL"
-        "       AND detResidExp.exp_id IS NULL"
+        "       AND detResidExp.exp_tag IS NULL"
         "   GROUP BY"
-        "       detInputExp.exp_id"
+        "       detInputExp.exp_tag"
         "   HAVING"
         "       rawDetrendExp.imfiles = COUNT(detResidImfile.class_id)"
@@ -3026,12 +3026,12 @@
     // select detRun.iteration
     // select detRun.det_type
-    // select detInputExp.exp_id
+    // select detInputExp.exp_tag
     // select detInputExp.include
     // by:
     // find the current iteration bassed on det_id
-    // find all exp_ids in the current det_id/iteration from detInputExp
+    // find all exp_tags in the current det_id/iteration from detInputExp
     // compare to detInputExp.imfiles to derResidImfile by class_id
     // and:
-    // detResidImfile.{det_id, iteration, exp_id} is not in detResidExp
+    // detResidImfile.{det_id, iteration, exp_tag} is not in detResidExp
 
     psString query = psStringCopy(
@@ -3039,5 +3039,5 @@
         "   det_id,"
         "   iteration,"
-        "   exp_id,"
+        "   exp_tag,"
         "   include"
         " FROM"
@@ -3046,5 +3046,5 @@
         "       detRun.iteration,"
         "       detRun.det_type,"
-        "       detInputExp.exp_id,"
+        "       detInputExp.exp_tag,"
         "       detInputExp.include,"
         "       rawDetrendExp.imfiles"
@@ -3054,19 +3054,19 @@
         "       AND detRun.iteration = detInputExp.iteration"
         "   LEFT JOIN rawDetrendExp"
-        "       ON detInputExp.exp_id = rawDetrendExp.exp_id"
+        "       ON detInputExp.exp_tag = rawDetrendExp.exp_tag"
         "   LEFT JOIN detResidImfile"
         "       ON detRun.position = detResidImfile.det_id"
         "       AND detRun.iteration = detResidImfile.iteration"
-        "       AND detInputExp.exp_id = detResidImfile.exp_id"
+        "       AND detInputExp.exp_tag = detResidImfile.exp_tag"
         "   LEFT JOIN detResidExp"
         "       ON detRun.position = detResidExp.det_id"
         "       AND detRun.iteration = detResidExp.iteration"
-        "       AND detInputExp.exp_id = detResidExp.exp_id"
+        "       AND detInputExp.exp_tag = detResidExp.exp_tag"
         "   WHERE"
         "       detResidExp.det_id IS NULL"
         "       AND detResidExp.iteration IS NULL"
-        "       AND detResidExp.exp_id IS NULL"
+        "       AND detResidExp.exp_tag IS NULL"
         "   GROUP BY"
-        "       detInputExp.exp_id"
+        "       detInputExp.exp_tag"
         "   HAVING"
         "       rawDetrendExp.imfiles = COUNT(detResidImfile.class_id)"
@@ -3075,5 +3075,5 @@
 
     {
-        // build a query to search by det_id, iteration, exp_id
+        // build a query to search by det_id, iteration, exp_tag
         psMetadata *where = psMetadataAlloc();
         bool status = false;
@@ -3107,14 +3107,14 @@
             return false;
         }
-        psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
-        if (!status) {
-            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
+        psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
+        if (!status) {
+            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
             psFree(where);
             psFree(query);
             return false;
         }
-        if (exp_id) {
-            if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==", exp_id)) {
-                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
+        if (exp_tag) {
+            if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", exp_tag)) {
+                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
                 psFree(where);
                 psFree(query);
@@ -3208,11 +3208,11 @@
         return false;
     }
-    psString exp_id = psMetadataLookupStr(&status, row, "exp_id");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for exp_id");
-        return false;
-    }
-    if (!exp_id) {
-        psError(PS_ERR_UNKNOWN, true, "exp_id is required");
+    psString exp_tag = psMetadataLookupStr(&status, row, "exp_tag");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for exp_tag");
+        return false;
+    }
+    if (!exp_tag) {
+        psError(PS_ERR_UNKNOWN, true, "exp_tag is required");
         return false;
     }
@@ -3283,5 +3283,5 @@
             det_id,
             iteration,
-            exp_id,
+            exp_tag,
             recipe,
             bg,
@@ -3343,7 +3343,7 @@
     // by:
     // find the current iteration bassed on det_id
-    // find all exp_ids in the current det_id/iteration from detInputExp
-    // find all exp_ids in the current det_id/iteration from detResidExp
-    // compare the counts of exp_ids
+    // find all exp_tags in the current det_id/iteration from detInputExp
+    // find all exp_tags in the current det_id/iteration from detResidExp
+    // compare the counts of exp_tags
 
     psString query = psStringCopy(
@@ -3357,5 +3357,5 @@
         "       detRun.iteration,"
         "       detRun.det_type,"
-        "       detInputExp.exp_id"
+        "       detInputExp.exp_tag"
         "   FROM detRun"
         "       LEFT JOIN detInputExp"
@@ -3363,14 +3363,14 @@
         "       AND detRun.iteration = detInputExp.iteration"
         "   LEFT JOIN rawDetrendExp"
-        "       ON detInputExp.exp_id = rawDetrendExp.exp_id"
+        "       ON detInputExp.exp_tag = rawDetrendExp.exp_tag"
         "   LEFT JOIN detResidExp"
         "       ON detRun.position = detResidExp.det_id"
         "       AND detRun.iteration = detResidExp.iteration"
-        "       AND detInputExp.exp_id = detResidExp.exp_id"
+        "       AND detInputExp.exp_tag = detResidExp.exp_tag"
         "   GROUP BY"
         "       detRun.position,"
         "       detRun.iteration"
         "   HAVING"
-        "       COUNT(detResidExp.exp_id) = COUNT(detInputExp.exp_id)"
+        "       COUNT(detResidExp.exp_tag) = COUNT(detInputExp.exp_tag)"
         " ) AS residdetrun"
         );
@@ -3425,5 +3425,5 @@
     PS_ASSERT_PTR_NON_NULL(config, false);
 
-    // build a query to search by det_id, iteration, exp_id
+    // build a query to search by det_id, iteration, exp_tag
     psMetadata *where = psMetadataAlloc();
     bool status = false;
@@ -3453,13 +3453,13 @@
         return false;
     }
-    psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
+    psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
         psFree(where);
         return false;
     }
-    if (exp_id) {
-        if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==", exp_id)) {
-            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
+    if (exp_tag) {
+        if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", exp_tag)) {
+            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
             psFree(where);
             return false;
@@ -3468,5 +3468,5 @@
 
     // find the values we're going to set
-    // copy everything but det_id, iteration, & exp_id from the args and
+    // copy everything but det_id, iteration, & exp_tag from the args and
     // remove the '-' prefix
     psMetadata *set = psMetadataAlloc();
@@ -3601,7 +3601,7 @@
     // by:
     // find the current iteration bassed on det_id
-    // find all exp_ids in the current det_id/iteration from detInputExp
-    // find all exp_ids in the current det_id/iteration from detResidExp
-    // compare the counts of exp_ids
+    // find all exp_tags in the current det_id/iteration from detInputExp
+    // find all exp_tags in the current det_id/iteration from detResidExp
+    // compare the counts of exp_tags
 
     psString query = psStringCopy(
@@ -3613,5 +3613,5 @@
         "       detRun.position AS det_id,"
         "       detRun.iteration,"
-        "       detInputExp.exp_id"
+        "       detInputExp.exp_tag"
         "   FROM detRun"
         "       LEFT JOIN detInputExp"
@@ -3619,19 +3619,19 @@
         "       AND detRun.iteration = detInputExp.iteration"
         "   LEFT JOIN rawDetrendExp"
-        "       ON detInputExp.exp_id = rawDetrendExp.exp_id"
+        "       ON detInputExp.exp_tag = rawDetrendExp.exp_tag"
         "   LEFT JOIN detResidExp"
         "       ON detRun.position = detResidExp.det_id"
         "       AND detRun.iteration = detResidExp.iteration"
-        "       AND detInputExp.exp_id = detResidExp.exp_id"
+        "       AND detInputExp.exp_tag = detResidExp.exp_tag"
         "   GROUP BY"
         "       detRun.position,"
         "       detRun.iteration"
         "   HAVING"
-        "       COUNT(detResidExp.exp_id) = COUNT(detInputExp.exp_id)"
+        "       COUNT(detResidExp.exp_tag) = COUNT(detInputExp.exp_tag)"
         " ) AS residdetrun"
         );
 
     {
-        // build a query to search by det_id, iteration, exp_id
+        // build a query to search by det_id, iteration, exp_tag
         psMetadata *where = psMetadataAlloc();
         bool status = false;
@@ -3839,11 +3839,11 @@
     // select detRun.position
     // select detRun.iteration
-    // select detInputExp.exp_id
+    // select detInputExp.exp_tag
     // select detResidExp.accept
     // by:
     // find the current iteration bassed on det_id
-    // find all exp_ids in the current det_id/iteration from detInputExp
-    // find all exp_ids in the current det_id/iteration from detResidExp
-    // compare the counts of exp_ids
+    // find all exp_tags in the current det_id/iteration from detInputExp
+    // find all exp_tags in the current det_id/iteration from detResidExp
+    // compare the counts of exp_tags
 
     psString query = psStringCopy(
@@ -3851,5 +3851,5 @@
         "   detRun.position AS det_id,"
         "   detRun.iteration,"
-        "   detInputExp.exp_id,"
+        "   detInputExp.exp_tag,"
         "   detResidExp.accept"
         " FROM detRun"
@@ -3860,14 +3860,14 @@
         "   ON detRun.position = detResidExp.det_id"
         "   AND detRun.iteration = detResidExp.iteration"
-        "   AND detInputExp.exp_id = detResidExp.exp_id"
+        "   AND detInputExp.exp_tag = detResidExp.exp_tag"
         " WHERE"
-        "   detInputExp.exp_id IS NOT NULL"
+        "   detInputExp.exp_tag IS NOT NULL"
         "   AND detResidExp.accept IS NOT NULL"
         " GROUP BY"
         "   detRun.position,"
         "   detRun.iteration,"
-        "   detInputExp.exp_id"
+        "   detInputExp.exp_tag"
         " HAVING"
-        "   COUNT(detResidExp.exp_id) = COUNT(detInputExp.exp_id)"
+        "   COUNT(detResidExp.exp_tag) = COUNT(detInputExp.exp_tag)"
         );
 
@@ -3910,5 +3910,5 @@
     for (long i = 0; i < psArrayLength(output); i++) {
         psMetadata *row = output->data[i];
-        psString exp_id = psMetadataLookupStr(&status, row, "exp_id");
+        psString exp_tag = psMetadataLookupStr(&status, row, "exp_tag");
         if (!status) {
             // rollback
@@ -3916,5 +3916,5 @@
                 psError(PS_ERR_UNKNOWN, false, "database error");
             }
-            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for exp_id");
+            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for exp_tag");
             psFree(output);
             return false;
@@ -3936,5 +3936,5 @@
                     (psS32)atol(det_id),
                     newIteration,
-                    exp_id,
+                    exp_tag,
                     accept
                 )
@@ -4098,15 +4098,15 @@
     }
 
-    // we have to support multipe exp_ids
-    psMetadataItem *item = psMetadataLookup(config->args, "-exp_id");
+    // we have to support multipe exp_tags
+    psMetadataItem *item = psMetadataLookup(config->args, "-exp_tag");
     if (!item) {
         // this shouldn't actually happen when using psArgs
-        psError(PS_ERR_UNKNOWN, true, "-exp_id is required");
-        return false;
-    }
-
-    psList *exp_id_list = item->data.list;
+        psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
+        return false;
+    }
+
+    psList *exp_tag_list = item->data.list;
     psMetadata *where = psMetadataAlloc();
-    // make sure that -exp_id was parsed correctly
+    // make sure that -exp_tag was parsed correctly
     // XXX this can be removed someday
     if (item->type == PS_DATA_METADATA_MULTI) {
@@ -4114,17 +4114,17 @@
         psMetadataItem *mItem = NULL;
         while ((mItem = psListGetAndIncrement(iter))) {
-            psString exp_id = mItem->data.V;
-            // if exp_id is NULL then it means that -exp_id has not been
+            psString exp_tag = mItem->data.V;
+            // if exp_tag is NULL then it means that -exp_tag has not been
             // specified
-            if (!exp_id) {
+            if (!exp_tag) {
                 psError(PS_ERR_UNKNOWN, true,
-                        "at least one -exp_id is required");
+                        "at least one -exp_tag is required");
                 psFree(where);
                 return false;
             }
 
-            if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id",
-                        PS_META_DUPLICATE_OK, "==", exp_id)) {
-                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
+            if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag",
+                        PS_META_DUPLICATE_OK, "==", exp_tag)) {
+                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
                 psFree(iter);
                 psFree(where);
@@ -4135,8 +4135,8 @@
     } else {
         psAbort(config->argv[0],
-                "-exp_id was not parsed correctly (this should not happen");
-    }
-
-    // check that the specified exp_ids actually exist in the iteration zero
+                "-exp_tag was not parsed correctly (this should not happen");
+    }
+
+    // check that the specified exp_tags actually exist in the iteration zero
     // detInputExp set
 
@@ -4162,9 +4162,9 @@
     }
 
-    // build a hash for the valid exp_ids
-    psHash *valid_exp_ids = psHashAlloc(psArrayLength(detrendExps));
+    // build a hash for the valid exp_tags
+    psHash *valid_exp_tags = psHashAlloc(psArrayLength(detrendExps));
     for (long i = 0; i < psArrayLength(detrendExps); i++) {
-        psHashAdd(valid_exp_ids,
-            ((detInputExpRow *)detrendExps->data[i])->exp_id,
+        psHashAdd(valid_exp_tags,
+            ((detInputExpRow *)detrendExps->data[i])->exp_tag,
             detrendExps->data[i]
         );
@@ -4176,5 +4176,5 @@
     if (!psDBTransaction(config->dbh)) {
         psError(PS_ERR_UNKNOWN, false, "database error");
-        psFree(valid_exp_ids);
+        psFree(valid_exp_tags);
         return false;
     }
@@ -4187,15 +4187,15 @@
             psError(PS_ERR_UNKNOWN, false, "database error");
         }
-        psFree(valid_exp_ids);
-        return false;
-    }
-
-    // check exp_ids and build up an array of new detInputExp rows at the same
+        psFree(valid_exp_tags);
+        return false;
+    }
+
+    // check exp_tags and build up an array of new detInputExp rows at the same
     // time
-    psListIterator *iter = psListIteratorAlloc(exp_id_list, 0, false);
+    psListIterator *iter = psListIteratorAlloc(exp_tag_list, 0, false);
     psMetadataItem *mItem = NULL;
-    psArray *newInputExps = psArrayAlloc(psListLength(exp_id_list));
+    psArray *newInputExps = psArrayAlloc(psListLength(exp_tag_list));
     while ((mItem = psListGetAndIncrement(iter))) {
-        detInputExpRow *inputExp = psHashLookup(valid_exp_ids,
+        detInputExpRow *inputExp = psHashLookup(valid_exp_tags,
                 (char *)mItem->data.V);
         if (!inputExp) {
@@ -4204,9 +4204,9 @@
                 psError(PS_ERR_UNKNOWN, false, "database error");
             }
-            // invalid exp_id
-            psError(PS_ERR_UNKNOWN, false, "exp_id %s is invalid for det_id %s",
+            // invalid exp_tag
+            psError(PS_ERR_UNKNOWN, false, "exp_tag %s is invalid for det_id %s",
                     (char *)mItem->data.V, det_id);
             psFree(iter);
-            psFree(valid_exp_ids);
+            psFree(valid_exp_tags);
             return false;
         }
@@ -4214,5 +4214,5 @@
             (psS32)atol(det_id),
             newIteration,
-            inputExp->exp_id,
+            inputExp->exp_tag,
             true   // use
         );
@@ -4221,5 +4221,5 @@
     }
     psFree(iter);
-    psFree(valid_exp_ids);
+    psFree(valid_exp_tags);
 
     for (long i = 0; i < psArrayLength(newInputExps); i++) {
Index: /trunk/ippTools/src/dettoolConfig.c
===================================================================
--- /trunk/ippTools/src/dettoolConfig.c	(revision 9056)
+++ /trunk/ippTools/src/dettoolConfig.c	(revision 9057)
@@ -23,5 +23,5 @@
     // -pending
     psMetadata *pendingArgs = psMetadataAlloc();
-    psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-exp_id",  0,
+    psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-exp_tag",  0,
             "search by exposure ID", NULL);
     psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-exp_type",  0,
@@ -40,5 +40,5 @@
     // -definebyexp 
     psMetadata *definebyexpArgs = psMetadataAlloc();
-    psMetadataAddStr(definebyexpArgs, PS_LIST_TAIL, "-exp_id",
+    psMetadataAddStr(definebyexpArgs, PS_LIST_TAIL, "-exp_tag",
             PS_META_DUPLICATE_OK,
             "include this exposure (multiple OK, required)", NULL);
@@ -100,5 +100,5 @@
     psMetadataAddS32(inputArgs, PS_LIST_TAIL, "-iteration",  0,
         "define iteration number", 0);
-    psMetadataAddStr(inputArgs, PS_LIST_TAIL, "-exp_id",  0,
+    psMetadataAddStr(inputArgs, PS_LIST_TAIL, "-exp_tag",  0,
         "search for exp ID", NULL);
     psMetadataAddBool(inputArgs, PS_LIST_TAIL, "-simple",  0,
@@ -109,5 +109,5 @@
     psMetadataAddStr(rawArgs, PS_LIST_TAIL, "-det_id",  0,
         "search for detrend ID", NULL);
-    psMetadataAddStr(rawArgs, PS_LIST_TAIL, "-exp_id",  0,
+    psMetadataAddStr(rawArgs, PS_LIST_TAIL, "-exp_tag",  0,
         "search for exp ID", NULL);
     psMetadataAddStr(rawArgs, PS_LIST_TAIL, "-class_id",  0,
@@ -120,5 +120,5 @@
     psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-det_id",  0,
         "define detrend ID (required)", NULL);
-    psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-exp_id",  0,
+    psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
         "define exp ID (required)", NULL);
     psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-class_id",  0,
@@ -150,5 +150,5 @@
     psMetadataAddS32(procArgs, PS_LIST_TAIL, "-iteration",  0,
         "searchfor iteration number", 0);
-    psMetadataAddStr(procArgs, PS_LIST_TAIL, "-exp_id",  0,
+    psMetadataAddStr(procArgs, PS_LIST_TAIL, "-exp_tag",  0,
         "search for exp ID", NULL);
     psMetadataAddStr(procArgs, PS_LIST_TAIL, "-class_id",  0,
@@ -290,5 +290,5 @@
     psMetadataAddS32(addresidimfileArgs, PS_LIST_TAIL, "-iteration",  0,
         "define iteration number", 0);
-    psMetadataAddStr(addresidimfileArgs, PS_LIST_TAIL, "-exp_id",  0,
+    psMetadataAddStr(addresidimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
         "define detrend ID (required)", NULL);
     psMetadataAddStr(addresidimfileArgs, PS_LIST_TAIL, "-class_id",  0,
@@ -315,5 +315,5 @@
     psMetadataAddS32(residimfileArgs, PS_LIST_TAIL, "-iteration",  0,
         "search for iteration number", 0);
-    psMetadataAddStr(residimfileArgs, PS_LIST_TAIL, "-exp_id",  0,
+    psMetadataAddStr(residimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
         "define detrend ID (required)", NULL);
     psMetadataAddStr(residimfileArgs, PS_LIST_TAIL, "-class_id",  0,
@@ -330,5 +330,5 @@
     psMetadataAddS32(addresidexpArgs, PS_LIST_TAIL, "-iteration",  0,
         "define iteration number", 0);
-    psMetadataAddStr(addresidexpArgs, PS_LIST_TAIL, "-exp_id",  0,
+    psMetadataAddStr(addresidexpArgs, PS_LIST_TAIL, "-exp_tag",  0,
         "define detrend ID (required)", NULL);
     psMetadataAddStr(addresidexpArgs, PS_LIST_TAIL, "-recip",  0,
@@ -353,5 +353,5 @@
     psMetadataAddS32(residexpArgs, PS_LIST_TAIL, "-iteration",  0,
         "search for iteration number", 0);
-    psMetadataAddStr(residexpArgs, PS_LIST_TAIL, "-exp_id",  0,
+    psMetadataAddStr(residexpArgs, PS_LIST_TAIL, "-exp_tag",  0,
         "search for exp ID", NULL);
     psMetadataAddStr(residexpArgs, PS_LIST_TAIL, "-recip",  0,
@@ -373,5 +373,5 @@
     psMetadataAddS32(updateresidexpArgs, PS_LIST_TAIL, "-iteration",  0,
         "define iteration number", 0);
-    psMetadataAddStr(updateresidexpArgs, PS_LIST_TAIL, "-exp_id",  0,
+    psMetadataAddStr(updateresidexpArgs, PS_LIST_TAIL, "-exp_tag",  0,
         "define exp ID", NULL);
     psMetadataAddStr(updateresidexpArgs, PS_LIST_TAIL, "-recip",  0,
@@ -448,5 +448,5 @@
     psMetadataAddStr(rerunArgs, PS_LIST_TAIL, "-det_id",  0,
         "search for detrend master for detrend ID (required)", NULL);
-    psMetadataAddStr(rerunArgs, PS_LIST_TAIL, "-exp_id",  PS_META_DUPLICATE_OK,
+    psMetadataAddStr(rerunArgs, PS_LIST_TAIL, "-exp_tag",  PS_META_DUPLICATE_OK,
         "include this exposure (multiple OK, required)", NULL);
 
@@ -567,5 +567,5 @@
     }
     addWhereStr(det_type);
-    addWhereStr(exp_id);
+    addWhereStr(exp_tag);
     addWhereStr(class_id);
     // convert '-inst' to 'camera'
Index: /trunk/ippTools/src/guidetool.c
===================================================================
--- /trunk/ippTools/src/guidetool.c	(revision 9056)
+++ /trunk/ippTools/src/guidetool.c	(revision 9057)
@@ -166,5 +166,5 @@
 
     return p1PendingExpRowAlloc(
-        exp->exp_id,
+        exp->exp_tag,
         exp->camera,
         exp->telescope,
Index: /trunk/ippTools/src/guidetoolConfig.c
===================================================================
--- /trunk/ippTools/src/guidetoolConfig.c	(revision 9056)
+++ /trunk/ippTools/src/guidetoolConfig.c	(revision 9057)
@@ -31,5 +31,5 @@
     // -pending search
     psMetadata *pendingArgs = psMetadataAlloc();
-    psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-exp_id",  0,
+    psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-exp_tag",  0,
         "define exposure ID", NULL);
     psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-inst",  0,
@@ -50,5 +50,5 @@
     // -define inputs
     psMetadata *defineArgs = psMetadataAlloc();
-    psMetadataAddStr(defineArgs, PS_LIST_TAIL, "-exp_id",  0,
+    psMetadataAddStr(defineArgs, PS_LIST_TAIL, "-exp_tag",  0,
         "define class", NULL);
     psMetadataAddStr(defineArgs, PS_LIST_TAIL, "-inst",  0,
@@ -142,5 +142,5 @@
     bool status = false;
 
-    addWhereStr(exp_id);
+    addWhereStr(exp_tag);
     // convert '-inst' to 'camera'
     if ((str = psMetadataLookupStr(&status, config->args, "-inst"))) {
Index: /trunk/ippTools/src/p2insertPendingFrames.c
===================================================================
--- /trunk/ippTools/src/p2insertPendingFrames.c	(revision 9056)
+++ /trunk/ippTools/src/p2insertPendingFrames.c	(revision 9057)
@@ -21,6 +21,6 @@
         psMetadata *where = psMetadataAlloc();
 
-        psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", PS_META_REPLACE, "==",
-            rawFrame->exposure->exp_id);
+        psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", PS_META_REPLACE, "==",
+            rawFrame->exposure->exp_tag);
         psArray *exposures = p2PendingExpSelectRowObjects(config->dbh,
             where, MAX_ROWS);
@@ -40,5 +40,5 @@
 
         p2PendingExpRow *pendingExposure = p2PendingExpRowAlloc(
-            rawFrame->exposure->exp_id,
+            rawFrame->exposure->exp_tag,
             "my recipe",
             0xff,
@@ -51,5 +51,5 @@
             rawImfileRow *rawImage = rawFrame->images->data[j];
             p2PendingImfileRow *pendingImage = p2PendingImfileRowAlloc(
-                rawImage->exp_id,
+                rawImage->exp_tag,
                 rawImage->class_id,
                 rawImage->uri,
Index: /trunk/ippTools/src/p2pendingToDone.c
===================================================================
--- /trunk/ippTools/src/p2pendingToDone.c	(revision 9056)
+++ /trunk/ippTools/src/p2pendingToDone.c	(revision 9057)
@@ -17,5 +17,5 @@
 
         p2DoneExpRow *doneExposure = p2DoneExpRowAlloc(
-            pendingFrame->exposure->exp_id,
+            pendingFrame->exposure->exp_tag,
             "my recipe",
             pendingFrame->exposure->p1_version,
@@ -34,5 +34,5 @@
 
             p2DoneImfileRow *doneImage = p2DoneImfileRowAlloc(
-                pendingImage->exp_id,
+                pendingImage->exp_tag,
                 pendingImage->class_id,
                 pendingImage->uri,
@@ -59,5 +59,5 @@
 
     p2DoneExpRow *doneExp = p2DoneExpRowAlloc(
-        pendingExp->exp_id,
+        pendingExp->exp_tag,
         "my recipe",
         pendingExp->p1_version,
Index: /trunk/ippTools/src/p2rawToPending.c
===================================================================
--- /trunk/ippTools/src/p2rawToPending.c	(revision 9056)
+++ /trunk/ippTools/src/p2rawToPending.c	(revision 9057)
@@ -16,5 +16,5 @@
 
         p2PendingExpRow *pendingExposure = p2PendingExpRowAlloc(
-            rawFrame->exposure->exp_id,
+            rawFrame->exposure->exp_tag,
             rawFrame->exposure->camera,
             rawFrame->exposure->telescope,
@@ -36,5 +36,5 @@
             rawImfileRow *rawImage = rawFrame->images->data[j];
             p2PendingImfileRow *pendingImage = p2PendingImfileRowAlloc(
-                rawImage->exp_id,
+                rawImage->exp_tag,
                 rawImage->class_id,
                 rawImage->uri,
Index: /trunk/ippTools/src/p2searchDoneFrames.c
===================================================================
--- /trunk/ippTools/src/p2searchDoneFrames.c	(revision 9056)
+++ /trunk/ippTools/src/p2searchDoneFrames.c	(revision 9057)
@@ -25,6 +25,6 @@
         // 'where' to select each exposure
         psMetadata *where = psMetadataAlloc ();
-        psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", PS_META_REPLACE, "==",
-            exposure->exp_id);
+        psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", PS_META_REPLACE, "==",
+            exposure->exp_tag);
 
         psArray *images = p2DoneImfileSelectRowObjects(config->dbh, where,
Index: /trunk/ippTools/src/p2searchPendingFrames.c
===================================================================
--- /trunk/ippTools/src/p2searchPendingFrames.c	(revision 9056)
+++ /trunk/ippTools/src/p2searchPendingFrames.c	(revision 9057)
@@ -25,5 +25,5 @@
         p2PendingExpRow *exposure = exposures->data[i];
 
-        psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", PS_META_REPLACE, "==", exposure->exp_id);
+        psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", PS_META_REPLACE, "==", exposure->exp_tag);
         psMetadataAddS32(where, PS_LIST_TAIL, "p2_version", PS_META_REPLACE, "==", exposure->p2_version);
 
@@ -61,18 +61,18 @@
     PS_ASSERT_PTR_NON_NULL(config, NULL);
 
-    // exp_id is optional
+    // exp_tag is optional
     bool status = false;
-    psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
+    psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
     if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
         return false;
     }
 
-    // search only based on exp_id -- either they specified it or not
+    // search only based on exp_tag -- either they specified it or not
     psMetadata *where = NULL;
-    if (exp_id) {
+    if (exp_tag) {
         where = psMetadataAlloc(); 
-        if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==", exp_id)) {
-            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
+        if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", exp_tag)) {
+            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
             psFree(where);
             return false;
Index: /trunk/ippTools/src/p2updatePending.c
===================================================================
--- /trunk/ippTools/src/p2updatePending.c	(revision 9056)
+++ /trunk/ippTools/src/p2updatePending.c	(revision 9057)
@@ -22,5 +22,5 @@
 
 	// find the next available version numbers
-	psMetadataAddStr (where, PS_LIST_TAIL, "EXP_ID",     PS_META_REPLACE, "==", exposure->exp_id);
+	psMetadataAddStr (where, PS_LIST_TAIL, "EXP_ID",     PS_META_REPLACE, "==", exposure->exp_tag);
 	psMetadataAddS32 (where, PS_LIST_TAIL, "P2_VERSION", PS_META_REPLACE, "==", exposure->p2_version);
 	psArray *images = p2PendingImfileSelectRowObjects (config->dbh, where, MAX_ROWS);
Index: /trunk/ippTools/src/pxframes.c
===================================================================
--- /trunk/ippTools/src/pxframes.c	(revision 9056)
+++ /trunk/ippTools/src/pxframes.c	(revision 9057)
@@ -80,5 +80,5 @@
 
 // XXX fix the exposure search so that it doesn't dump the entire table
-#define PX_FRAME_SEARCH(frametype, exptype, imfiletype) \
+#define PX_FRAME_SEARCH(frametype, exptype, imfiletype, key) \
 psArray *frametype##Search(pxConfig *config) \
 { \
@@ -98,6 +98,6 @@
 \
         psMetadata *where = psMetadataAlloc(); \
-        psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", PS_META_REPLACE, "==", \
-            exposure->exp_id); \
+        psMetadataAddStr(where, PS_LIST_TAIL, #key, PS_META_REPLACE, "==", \
+            exposure->key); \
  \
         psArray *images = imfiletype##SelectRowObjects(config->dbh, where, \
@@ -105,5 +105,5 @@
         psFree(where); \
         if (!images) { \
-            psError(PS_ERR_UNKNOWN, false, "no " #imfiletype " rows found for exp_id %s", exposure->exp_id); \
+            psError(PS_ERR_UNKNOWN, false, "no " #imfiletype " rows found for key %s", exposure->key); \
  \
             continue; \
@@ -126,9 +126,9 @@
 } 
 
-PX_FRAME_SEARCH(pzPendingFrame, pzPendingExp, pzPendingImfile);
-PX_FRAME_SEARCH(newFrame, newExp, newImfile);
-PX_FRAME_SEARCH(rawDetrendFrame, rawDetrendExp, rawImfile);
-PX_FRAME_SEARCH(rawScienceFrame, rawScienceExp, rawImfile);
-PX_FRAME_SEARCH(p2PendingFrame, p2PendingExp, p2PendingImfile);
+PX_FRAME_SEARCH(pzPendingFrame, pzPendingExp, pzPendingImfile, exp_id);
+//PX_FRAME_SEARCH(newFrame, newExp, newImfile);
+PX_FRAME_SEARCH(rawDetrendFrame, rawDetrendExp, rawImfile, exp_tag);
+PX_FRAME_SEARCH(rawScienceFrame, rawScienceExp, rawImfile, exp_tag);
+PX_FRAME_SEARCH(p2PendingFrame, p2PendingExp, p2PendingImfile, exp_tag);
 
 
@@ -172,5 +172,5 @@
         newImfileRow *newImfile = newImages->data[i];
         rawImfileRow *rawImfile = rawImfileRowAlloc(
-            newImfile->exp_id,
+            newImfile->exp_tag,
             newImfile->class,
             newImfile->class_id,
Index: /trunk/ippTools/src/pxinject.c
===================================================================
--- /trunk/ippTools/src/pxinject.c	(revision 9056)
+++ /trunk/ippTools/src/pxinject.c	(revision 9057)
@@ -52,4 +52,13 @@
     bool status = false;
 
+    psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
+        return false;
+    }
+    if (!exp_tag) {
+        psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
+        return false;
+    }
     psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
     if (!status) {
@@ -98,5 +107,5 @@
     }
 
-    if (!newExpInsert(config->dbh, exp_id, camera, telescope, exp_type, imfiles)) {
+    if (!newExpInsert(config->dbh, exp_tag, exp_id, camera, telescope, exp_type, imfiles)) {
         psError(PS_ERR_UNKNOWN, false, "database error");
         return false;
@@ -110,11 +119,11 @@
     bool status = false;
 
-    psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
+    psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
     if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
         return false;
     }
-    if (!exp_id) {
-        psError(PS_ERR_UNKNOWN, true, "-exp_id is required");
+    if (!exp_tag) {
+        psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
         return false;
     }
@@ -147,5 +156,5 @@
     }
 
-    if (!newImfileInsert(config->dbh, exp_id, class, class_id, uri)) {
+    if (!newImfileInsert(config->dbh, exp_tag, class, class_id, uri)) {
         psError(PS_ERR_UNKNOWN, false, "database error");
         return false;
Index: /trunk/ippTools/src/pxinjectConfig.c
===================================================================
--- /trunk/ippTools/src/pxinjectConfig.c	(revision 9056)
+++ /trunk/ippTools/src/pxinjectConfig.c	(revision 9057)
@@ -23,4 +23,6 @@
     // -newExp
     psMetadata *newExpArgs = psMetadataAlloc();
+    psMetadataAddStr(newExpArgs, PS_LIST_TAIL, "-exp_tag",  0,
+        "define the exp_tag (required)", NULL);
     psMetadataAddStr(newExpArgs, PS_LIST_TAIL, "-exp_id",  0,
         "define the exp_id (required)", NULL);
@@ -36,6 +38,6 @@
     // -newImfile
     psMetadata *newImfileArgs = psMetadataAlloc();
-    psMetadataAddStr(newImfileArgs, PS_LIST_TAIL, "-exp_id",  0,
-        "define the exp_id (required)", NULL);
+    psMetadataAddStr(newImfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
+        "define the exp_tag (required)", NULL);
     psMetadataAddStr(newImfileArgs, PS_LIST_TAIL, "-class",  0,
         "define the class (required)", NULL);
@@ -116,5 +118,5 @@
     }
     addWhereStr(det_type);
-    addWhereStr(exp_id);
+    addWhereStr(exp_tag);
     addWhereStr(class_id);
     // convert '-inst' to 'camera'
Index: /trunk/ippTools/src/pzgetimfiles.c
===================================================================
--- /trunk/ippTools/src/pzgetimfiles.c	(revision 9056)
+++ /trunk/ippTools/src/pzgetimfiles.c	(revision 9057)
@@ -152,4 +152,8 @@
     PS_ASSERT_PTR_NON_NULL(str, NULL);
 
+    bool status = false;
+    psString camera     = psMetadataLookupStr(&status, config->args, "-inst");
+    psString telescope  = psMetadataLookupStr(&status, config->args, "-telescope");
+
     psList *doc = psStringSplit(str, "\n", false);
 
@@ -192,4 +196,6 @@
         pzPendingImfileRow *row = pzPendingImfileRowAlloc(
             exp_id,
+            camera,
+            telescope,
             (psS32)atol(bytes),
             md5sum,
Index: /trunk/ippTools/src/pzgetimfilesConfig.c
===================================================================
--- /trunk/ippTools/src/pzgetimfilesConfig.c	(revision 9056)
+++ /trunk/ippTools/src/pzgetimfilesConfig.c	(revision 9057)
@@ -24,7 +24,12 @@
     psMetadata *args = psMetadataAlloc();
     psMetadataAddStr(args , PS_LIST_TAIL, "-uri", 0,
-        "DataStore FileSet URI", "");
+            "DataStore FileSet URI", "");
     psMetadataAddStr(args , PS_LIST_TAIL, "-filesetid", 0,
-        "FileSet ID", "");
+            "FileSet ID", "");
+    psMetadataAddStr(args, PS_LIST_TAIL, "-inst",  0,
+            "search by camera", NULL);
+    psMetadataAddStr(args, PS_LIST_TAIL, "-telescope",  0,
+            "search by telescope", NULL);
+
 
     bool status = false;
Index: /trunk/ippTools/src/pztool.c
===================================================================
--- /trunk/ippTools/src/pztool.c	(revision 9056)
+++ /trunk/ippTools/src/pztool.c	(revision 9057)
@@ -253,4 +253,6 @@
             if (!newExpInsert(
                     config->dbh,
+                    // XXX exp_tag needs to be generated
+                    "FIXME exp_tag",
                     pendingExp->exp_id,
                     pendingExp->camera,
Index: /trunk/ippTools/src/pztoolConfig.c
===================================================================
--- /trunk/ippTools/src/pztoolConfig.c	(revision 9056)
+++ /trunk/ippTools/src/pztoolConfig.c	(revision 9057)
@@ -23,5 +23,5 @@
     // -seen
     psMetadata *seenArgs = psMetadataAlloc();
-    psMetadataAddStr(seenArgs, PS_LIST_TAIL, "-exp_id",  0,
+    psMetadataAddStr(seenArgs, PS_LIST_TAIL, "-exp_tag",  0,
         "define exposure ID", NULL); 
     psMetadataAddStr(seenArgs, PS_LIST_TAIL, "-inst",  0,
@@ -34,5 +34,5 @@
     // -pending
     psMetadata *pendingArgs = psMetadataAlloc();
-    psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-exp_id",  0,
+    psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-exp_tag",  0,
         "define exposure ID", NULL); 
     psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-inst",  0,
@@ -45,5 +45,5 @@
     // -copydone
     psMetadata *copydoneArgs = psMetadataAlloc();
-    psMetadataAddStr(copydoneArgs, PS_LIST_TAIL, "-exp_id",  0,
+    psMetadataAddStr(copydoneArgs, PS_LIST_TAIL, "-exp_tag",  0,
         "define exposure ID", NULL); 
     psMetadataAddStr(copydoneArgs, PS_LIST_TAIL, "-class",  0,
@@ -120,5 +120,5 @@
     config->where = psMetadataAlloc();
 
-    addWhereStr(exp_id); 
+    addWhereStr(exp_tag); 
     addWhereStr(class); 
     addWhereStr(class_id); 
Index: /trunk/ippTools/src/regtool.c
===================================================================
--- /trunk/ippTools/src/regtool.c	(revision 9056)
+++ /trunk/ippTools/src/regtool.c	(revision 9057)
@@ -72,14 +72,14 @@
         "SELECT newExp.*"
         "   FROM newExp"
-        " LEFT JOIN newImfile USING(exp_id)"
-        " LEFT JOIN rawScienceExp USING(exp_id)"
-        " LEFT JOIN rawDetrendExp USING(exp_id)"
+        " LEFT JOIN newImfile USING(exp_tag)"
+        " LEFT JOIN rawScienceExp USING(exp_tag)"
+        " LEFT JOIN rawDetrendExp USING(exp_tag)"
         " WHERE"
-        "   newExp.exp_id IS NOT NULL"
-        "   AND newImfile.exp_id IS NULL"
-        "   AND rawScienceExp.exp_id IS NULL"
+        "   newExp.exp_tag IS NOT NULL"
+        "   AND newImfile.exp_tag IS NULL"
+        "   AND rawScienceExp.exp_tag IS NULL"
         "   AND newExp.imfiles ="
-        "   (SELECT COUNT(exp_id) FROM rawImfile"
-        "       WHERE rawImfile.exp_id = newExp.exp_id)"
+        "   (SELECT COUNT(exp_tag) FROM rawImfile"
+        "       WHERE rawImfile.exp_tag = newExp.exp_tag)"
         ;
 
@@ -123,17 +123,17 @@
 
     // select newImfiles that:
-    // exp_id is in newExp
-    // don't have their exp_id in rawScienceExp 
-    // don't have their exp_id in rawDetrendExp
-    // XXX having the same exp_id in newExp and raw*Exp is probably an error
+    // exp_tag is in newExp
+    // don't have their exp_tag in rawScienceExp 
+    // don't have their exp_tag in rawDetrendExp
+    // XXX having the same exp_tag in newExp and raw*Exp is probably an error
     // that should be checked for
     char *query =
         "SELECT newImfile.* FROM newImfile"
-        " LEFT JOIN newExp USING(exp_id)"
-        " LEFT JOIN rawScienceExp USING(exp_id)"
-        " LEFT JOIN rawDetrendExp USING (exp_id)"
-        " WHERE newExp.exp_id is NOT NULL"
-        " AND rawScienceExp.exp_id IS NULL"
-        " AND rawDetrendExp.exp_id IS NULL";
+        " LEFT JOIN newExp USING(exp_tag)"
+        " LEFT JOIN rawScienceExp USING(exp_tag)"
+        " LEFT JOIN rawDetrendExp USING (exp_tag)"
+        " WHERE newExp.exp_tag is NOT NULL"
+        " AND rawScienceExp.exp_tag IS NULL"
+        " AND rawDetrendExp.exp_tag IS NULL";
 
     if (!p_psDBRunQuery(config->dbh, query)) {
@@ -175,8 +175,8 @@
     PS_ASSERT_PTR_NON_NULL(config, false);
 
-    // make sure that the exp_id(s) are ready to be updated based on:
-    // exp_id is not in rawScienceExp
-    // exp_id is not in rawDetrendExp
-    // exp_id is not in newImfile
+    // make sure that the exp_tag(s) are ready to be updated based on:
+    // exp_tag is not in rawScienceExp
+    // exp_tag is not in rawDetrendExp
+    // exp_tag is not in newImfile
     // that the correct count of imfiles is in rawImfile
 
@@ -184,26 +184,26 @@
         "SELECT newExp.*"
         "   FROM newExp"
-        " LEFT JOIN newImfile USING(exp_id)"
-        " LEFT JOIN rawScienceExp USING(exp_id)"
-        " LEFT JOIN rawDetrendExp USING(exp_id)"
+        " LEFT JOIN newImfile USING(exp_tag)"
+        " LEFT JOIN rawScienceExp USING(exp_tag)"
+        " LEFT JOIN rawDetrendExp USING(exp_tag)"
         " WHERE"
-        "   newExp.exp_id IS NOT NULL"
-        "   AND newImfile.exp_id IS NULL"
-        "   AND rawScienceExp.exp_id IS NULL"
+        "   newExp.exp_tag IS NOT NULL"
+        "   AND newImfile.exp_tag IS NULL"
+        "   AND rawScienceExp.exp_tag IS NULL"
         "   AND newExp.imfiles ="
-        "   (SELECT COUNT(exp_id) FROM rawImfile"
-        "       WHERE rawImfile.exp_id = newExp.exp_id)"
+        "   (SELECT COUNT(exp_tag) FROM rawImfile"
+        "       WHERE rawImfile.exp_tag = newExp.exp_tag)"
         );
 
     {        
         bool status = false;
-        psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
+        psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
         if (!status) {
-            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
+            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
             psFree(query);
             return false;
         }
-        if (exp_id) {
-            psStringAppend(&query, " AND newExp.exp_id = '%s'", exp_id);
+        if (exp_tag) {
+            psStringAppend(&query, " AND newExp.exp_tag = '%s'", exp_tag);
         }
     }
@@ -359,12 +359,12 @@
         psArray *rawImfiles = NULL;
         {
-            // build a query to search by exp_id
+            // build a query to search by exp_tag
             psMetadata *where = psMetadataAlloc();
-            if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==", newExp->exp_id)) {
+            if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", newExp->exp_tag)) {
                 // rollback
                 if (!psDBRollback(config->dbh)) {
                     psError(PS_ERR_UNKNOWN, false, "database error");
                 }
-                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
+                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
                 psFree(where);
                 psFree(newExp);
@@ -381,5 +381,5 @@
                 psError(PS_ERR_UNKNOWN, false, "database error");
             }
-            psError(PS_ERR_UNKNOWN, false, "found no rawImfiles associated with exp_id %s", newExp->exp_id);
+            psError(PS_ERR_UNKNOWN, false, "found no rawImfiles associated with exp_tag %s", newExp->exp_tag);
             psFree(newExp);
             psFree(output);
@@ -439,25 +439,25 @@
         "SELECT * FROM"
             " (SELECT newImfile.* FROM newImfile"
-                " LEFT JOIN newExp USING(exp_id)"
-                " LEFT JOIN rawScienceExp USING(exp_id)"
-                " LEFT JOIN rawDetrendExp USING (exp_id)"
-                " WHERE newExp.exp_id IS NOT NULL"
-                " AND rawScienceExp.exp_id IS NULL"
-                " AND rawDetrendExp.exp_id IS NULL) AS foo"
-        ); // WHERE class is generated from exp_id, class, & class_id
+                " LEFT JOIN newExp USING(exp_tag)"
+                " LEFT JOIN rawScienceExp USING(exp_tag)"
+                " LEFT JOIN rawDetrendExp USING (exp_tag)"
+                " WHERE newExp.exp_tag IS NOT NULL"
+                " AND rawScienceExp.exp_tag IS NULL"
+                " AND rawDetrendExp.exp_tag IS NULL) AS foo"
+        ); // WHERE class is generated from exp_tag, class, & class_id
 
     {
-        // build a query to search by exp_id, class, class_id
+        // build a query to search by exp_tag, class, class_id
         psMetadata *where = psMetadataAlloc();
         bool status = false;
-        psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
+        psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
         if (!status) {
-            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
+            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
             psFree(query);
             return false;
         }
-        if (exp_id) {
-            if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==", exp_id)) {
-                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
+        if (exp_tag) {
+            if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", exp_tag)) {
+                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
                 psFree(where);
                 psFree(query);
@@ -619,5 +619,5 @@
 {
     return p1PendingExpRowAlloc(
-        newExp->exp_id,
+        newExp->exp_tag,
         newExp->camera,
         newExp->telescope,
@@ -642,5 +642,5 @@
 
     return p2PendingExpRowAlloc(
-        exp->exp_id,
+        exp->exp_tag,
         "my recipe",
         0xff, // XXX calc version number
@@ -652,5 +652,5 @@
 {
     return p2PendingImfileRowAlloc(
-        rawImfile->exp_id,
+        rawImfile->exp_tag,
         rawImfile->class_id,
         rawImfile->uri,
@@ -796,5 +796,5 @@
 
     return rawDetrendExpRowAlloc(
-        exp->exp_id,
+        exp->exp_tag,
         exp->camera,
         exp->telescope,
@@ -941,5 +941,5 @@
 
     return rawImfileRowAlloc(
-        imfile->exp_id,
+        imfile->exp_tag,
         imfile->class,
         imfile->class_id,
Index: /trunk/ippTools/src/regtoolConfig.c
===================================================================
--- /trunk/ippTools/src/regtoolConfig.c	(revision 9056)
+++ /trunk/ippTools/src/regtoolConfig.c	(revision 9057)
@@ -24,5 +24,5 @@
     // -pendingexp
     psMetadata *pendingexpArgs = psMetadataAlloc();
-    psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-exp_id",  0,
+    psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-exp_tag",  0,
         "search by exposure ID", NULL);
     psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-inst",  0,
@@ -39,5 +39,5 @@
     // -pendingimfile
     psMetadata *pendingimfileArgs = psMetadataAlloc();
-    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-exp_id",  0,
+    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
         "search by exposure ID", NULL);
     psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-class",  0,
@@ -51,6 +51,6 @@
     // -updateexp
     psMetadata *updateexpArgs = psMetadataAlloc();
-    psMetadataAddStr(updateexpArgs, PS_LIST_TAIL, "-exp_id",  0,
-        "exp_id to operate on", NULL); 
+    psMetadataAddStr(updateexpArgs, PS_LIST_TAIL, "-exp_tag",  0,
+        "exp_tag to operate on", NULL); 
     psMetadataAddStr(updateexpArgs, PS_LIST_TAIL, "-exp_type",  0,
         "define exposure type", NULL);
@@ -90,5 +90,5 @@
     // -updateimfile
     psMetadata *updateimfileArgs = psMetadataAlloc();
-    psMetadataAddStr(updateimfileArgs, PS_LIST_TAIL, "-exp_id",  0,
+    psMetadataAddStr(updateimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
         "search by exposure ID", NULL);
     psMetadataAddStr(updateimfileArgs, PS_LIST_TAIL, "-class",  0,
@@ -125,5 +125,5 @@
     // -rawimfile
     psMetadata *rawimfileArgs = psMetadataAlloc();
-    psMetadataAddStr(rawimfileArgs, PS_LIST_TAIL, "-exp_id",  0,
+    psMetadataAddStr(rawimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
         "search by exposure ID", NULL);
     psMetadataAddStr(rawimfileArgs, PS_LIST_TAIL, "-class_id",  0,
@@ -205,5 +205,5 @@
     config->where = psMetadataAlloc();
 
-    addWhereStr(exp_id);
+    addWhereStr(exp_tag);
     // convert '-inst' to 'camera'
     {
