Index: trunk/ippTools/src/camtool.c
===================================================================
--- trunk/ippTools/src/camtool.c	(revision 14018)
+++ trunk/ippTools/src/camtool.c	(revision 14023)
@@ -144,6 +144,6 @@
 }
 
-    ADDPARAMSTR(config->args, where, "exp_tag");
     ADDPARAMSTR(config->args, where, "exp_id");
+    ADDPARAMSTR(config->args, where, "exp_name");
     ADDPARAMSTR(config->args, where, "inst");
     ADDPARAMSTR(config->args, where, "telescope");
Index: trunk/ippTools/src/camtoolConfig.c
===================================================================
--- trunk/ippTools/src/camtoolConfig.c	(revision 14018)
+++ trunk/ippTools/src/camtoolConfig.c	(revision 14023)
@@ -50,8 +50,8 @@
     psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-chip_id",  0,
             "search by chip_id", NULL);
-    psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-exp_tag",  0,
-            "search by exp_tag", NULL);
     psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-exp_id",  0,
             "search by exp_id", NULL);
+    psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-exp_name",  0,
+            "search by exp_name", NULL);
     psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-inst",  0,
             "search by camera", NULL);
Index: trunk/ippTools/src/chiptool.c
===================================================================
--- trunk/ippTools/src/chiptool.c	(revision 14018)
+++ trunk/ippTools/src/chiptool.c	(revision 14023)
@@ -132,6 +132,6 @@
 
     psMetadata *where = psMetadataAlloc();
-    ADDPARAMSTR(config->args, where, "exp_tag");
     ADDPARAMSTR(config->args, where, "exp_id");
+    ADDPARAMSTR(config->args, where, "exp_name");
     ADDRENAMEPARAMSTR(config->args, where, "inst", "camera");
     ADDPARAMSTR(config->args, where, "telescope");
@@ -190,5 +190,5 @@
     }
 
-    // find the exp_tag of all the exposures that we want to queue up.
+    // find the exp_id of all the exposures that we want to queue up.
     psString query = pxDataGet("chiptool_find_rawexp.sql");
     if (!query) {
@@ -230,11 +230,11 @@
     }
 
-    // loop over our list of exp_tags
+    // loop over our list of exp_ids
     for (long i = 0; i < psArrayLength(output); i++) {
         psMetadata *md = output->data[i];
 
-        psString exp_tag = psMetadataLookupStr(&status, md, "exp_tag");
+        psString exp_id = psMetadataLookupStr(&status, md, "exp_id");
         if (!status) {
-            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for exp_tag");
+            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for exp_id");
             psFree(output);
             return false;
@@ -242,10 +242,10 @@
 
         // queue the exp
-        if (!pxchipQueueByExpTag(config, exp_tag, workdir, label, reduction, expgroup, dvodb)) {
+        if (!pxchipQueueByExpTag(config, exp_id, workdir, label, reduction, expgroup, dvodb)) {
             if (!psDBRollback(config->dbh)) {
                 psError(PS_ERR_UNKNOWN, false, "database error");
             }
             psError(PS_ERR_UNKNOWN, false,
-                    "failed to trying to queue exp_tag: %s", exp_tag);
+                    "failed to trying to queue exp_id: %s", exp_id);
             psFree(output);
             return false;
@@ -357,11 +357,11 @@
     }
 
-    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");
+    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");
         return false;
     }
@@ -511,6 +511,6 @@
 
     chipProcessedImfileRow *imfile = chipProcessedImfileRowAlloc(
-        (psU64)atoll(chip_id),
-        exp_tag,
+        (psS64)atoll(chip_id),
+        (psS64)atoll(exp_id),
         class_id,
         uri,
Index: trunk/ippTools/src/chiptoolConfig.c
===================================================================
--- trunk/ippTools/src/chiptoolConfig.c	(revision 14018)
+++ trunk/ippTools/src/chiptoolConfig.c	(revision 14023)
@@ -46,8 +46,8 @@
     // -queue
     psMetadata *queueArgs = psMetadataAlloc();
-    psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-exp_tag",  0,
-            "search by exp_tag", NULL);
     psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-exp_id",  0,
             "search by exp_id", NULL);
+    psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-exp_name",  0,
+            "search by exp_name", NULL);
     psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-inst",  0,
             "search by camera", NULL);
@@ -106,5 +106,5 @@
     psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-chip_id",  0,
             "search by chip ID", NULL);
-    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
+    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-exp_id",  0,
             "search by exposure ID", NULL);
     psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-class",  0,
@@ -127,5 +127,5 @@
     psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-chip_id",  0,
             "define chip ID (required)", NULL);
-    psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
+    psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-exp_id",  0,
             "define exposure ID", NULL);
     psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-class_id",  0,
@@ -181,5 +181,5 @@
     psMetadataAddStr(processedimfileArgs, PS_LIST_TAIL, "-chip_id",  0,
             "define chip ID", NULL);
-    psMetadataAddStr(processedimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
+    psMetadataAddStr(processedimfileArgs, PS_LIST_TAIL, "-exp_id",  0,
             "define exposure ID", NULL);
     psMetadataAddStr(processedimfileArgs, PS_LIST_TAIL, "-class",  0,
@@ -204,5 +204,5 @@
     psMetadataAddStr(updateprocessedimfileArgs, PS_LIST_TAIL, "-chip_id",  0,
             "define chip ID", NULL);
-    psMetadataAddStr(updateprocessedimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
+    psMetadataAddStr(updateprocessedimfileArgs, PS_LIST_TAIL, "-exp_id",  0,
             "search by exposure ID", NULL);
     psMetadataAddStr(updateprocessedimfileArgs, PS_LIST_TAIL, "-class",  0,
@@ -217,5 +217,5 @@
     psMetadataAddStr(retryprocessedimfileArgs, PS_LIST_TAIL, "-chip_id",  0,
             "define chip ID (required)", NULL);
-    psMetadataAddStr(retryprocessedimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
+    psMetadataAddStr(retryprocessedimfileArgs, PS_LIST_TAIL, "-exp_id",  0,
             "search by exposure ID", NULL);
     psMetadataAddStr(retryprocessedimfileArgs, PS_LIST_TAIL, "-class",  0,
@@ -294,5 +294,5 @@
 }
 
-    addWhereStr(exp_tag);
+    addWhereStr(exp_id);
     // convert '-inst' to 'camera'
     {
Index: trunk/ippTools/src/detselectConfig.c
===================================================================
--- trunk/ippTools/src/detselectConfig.c	(revision 14018)
+++ trunk/ippTools/src/detselectConfig.c	(revision 14023)
@@ -183,5 +183,5 @@
     addWhereStr(det_id);
     addWhereS32(iteration);
-    addWhereStr(exp_tag);
+    addWhereStr(exp_id);
     // convert '-inst' to 'camera'
     {
Index: trunk/ippTools/src/dettool.c
===================================================================
--- trunk/ippTools/src/dettool.c	(revision 14018)
+++ trunk/ippTools/src/dettool.c	(revision 14023)
@@ -173,7 +173,7 @@
         " FROM rawExp"
         " LEFT JOIN detInputExp"
-        "   ON rawExp.exp_tag = detInputExp.exp_tag"
+        "   ON rawExp.exp_id = detInputExp.exp_id"
         " WHERE"
-        "    detInputExp.exp_tag IS NULL"
+        "    detInputExp.exp_id IS NULL"
         "    AND rawExp.obstype != 'object'"
     );
@@ -461,14 +461,14 @@
     }
 
-    // we have to support multipe exp_tags
-    psMetadataItem *item = psMetadataLookup(config->args, "-exp_tag");
+    // we have to support multipe exp_ids
+    psMetadataItem *item = psMetadataLookup(config->args, "-exp_id");
     if (!item) {
         // this shouldn't actually happen when using psArgs
-        psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
+        psError(PS_ERR_UNKNOWN, true, "-exp_id is required");
         return false;
     }
     psMetadata *where = psMetadataAlloc();
 
-    // make sure that -exp_tag was parsed correctly
+    // make sure that -exp_id was parsed correctly
     // XXX this can be removed someday
     if (item->type == PS_DATA_METADATA_MULTI) {
@@ -476,17 +476,17 @@
         psMetadataItem *mItem = NULL;
         while ((mItem = psListGetAndIncrement(iter))) {
-            psString exp_tag = mItem->data.V;
-            // if exp_tag is NULL then it means that -exp_tag has not been
+            psString exp_id = mItem->data.V;
+            // if exp_id is NULL then it means that -exp_id has not been
             // specified
-            if (!exp_tag) {
+            if (!exp_id) {
                 psError(PS_ERR_UNKNOWN, true,
-                        "at least one -exp_tag is required");
+                        "at least one -exp_id is required");
                 psFree(where);
                 return false;
             }
 
-            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");
+            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");
                 psFree(iter);
                 psFree(where);
@@ -496,5 +496,5 @@
         psFree(iter);
     } else {
-        psAbort(                "-exp_tag was not parsed correctly (this should not happen");
+        psAbort(                "-exp_id was not parsed correctly (this should not happen");
     }
 
@@ -504,5 +504,5 @@
     }
 
-    // check that the specified exp_tags actually exist
+    // check that the specified exp_ids actually exist
     psArray *detrendExps = rawExpSelectRowObjects(config->dbh, where, 0);
     psFree(where);
@@ -512,7 +512,7 @@
     }
 
-    // we should have one rawExp row per exp_tag specified
+    // we should have one rawExp row per exp_id specified
     if (psListLength(item->data.list) != psArrayLength(detrendExps)) {
-        psAbort(    "an -exp_tag matched more then one rawExp (this should not happen");
+        psAbort(    "an -exp_id matched more then one rawExp (this should not happen");
 
     }
@@ -1768,9 +1768,9 @@
         "       %d,"
         "       0,"
-        "       detResidExp.exp_tag,"
+        "       detResidExp.exp_id,"
         "       detResidExp.accept"
         "   FROM detResidExp"
         "   JOIN rawExp"
-        "       USING(exp_tag)"
+        "       USING(exp_id)"
         "   WHERE det_id = %d"
     );
@@ -1979,5 +1979,5 @@
         det_id,
         iteration,
-        rawExp->exp_tag,
+        rawExp->exp_id,
         true            // use
     );
@@ -1991,5 +1991,5 @@
     // select rawExp.*
     // by:
-    // exp_tag
+    // exp_id
 
     psString query = psStringCopy(
@@ -1997,5 +1997,5 @@
         " FROM detInputExp"
         " JOIN rawExp"
-        " USING(exp_tag)"
+        " USING(exp_id)"
         );
 
@@ -2058,7 +2058,7 @@
             " FROM rawImfile"
             " JOIN detInputExp"
-            "   USING(exp_tag) "
+            "   USING(exp_id) "
             " JOIN rawExp"
-            "   USING(exp_tag) "
+            "   USING(exp_id) "
             " JOIN detRun"
             "   ON detInputExp.det_id = detRun.det_id"
@@ -2130,7 +2130,7 @@
     //
     // det_id is in detInputExp
-    // exp_tag is in detInputExp
+    // exp_id is in detInputExp
     // det_id is not in detProccessedImfile
-    // exp_tag is not in detProccessedImfile
+    // exp_id is not in detProccessedImfile
     // class_is is not in detProccessedImfile
     psString query = psStringCopy(
@@ -2146,10 +2146,10 @@
             "    USING(det_id, iteration)"
             " JOIN rawExp"
-            "    ON detInputExp.exp_tag = rawExp.exp_tag"
+            "    ON detInputExp.exp_id = rawExp.exp_id"
             " JOIN rawImfile"
-            "    ON detInputExp.exp_tag = rawImfile.exp_tag"
+            "    ON detInputExp.exp_id = rawImfile.exp_id"
             " LEFT JOIN detProcessedImfile"
             "   ON detInputExp.det_id = detProcessedImfile.det_id"
-            "   AND rawImfile.exp_tag = detProcessedImfile.exp_tag"
+            "   AND rawImfile.exp_id = detProcessedImfile.exp_id"
             "   AND rawImfile.class_id = detProcessedImfile.class_id"
             " WHERE"
@@ -2157,5 +2157,5 @@
             "   AND detRun.mode = 'master'"
             "   AND detProcessedImfile.det_id IS NULL"
-            "   AND detProcessedImfile.exp_tag IS NULL"
+            "   AND detProcessedImfile.exp_id IS NULL"
             "   AND detProcessedImfile.class_id IS NULL"
         );
@@ -2223,5 +2223,5 @@
     }
 
-    // select exp_tags from detInputExp matching det_idp
+    // select exp_ids from detInputExp matching det_idp
     // where query should be pre-generated
     psArray *detInputExp =
@@ -2232,14 +2232,14 @@
     }
 
-    // generate where query with just the exp_tags
-    psMetadata *where_exp_tags = psMetadataAlloc();
+    // generate where query with just the exp_ids
+    psMetadata *where_exp_ids = psMetadataAlloc();
     for (long i = 0; i < psArrayLength(detInputExp); i++) {
         detInputExpRow *row = detInputExp->data[i];
-        if (!psMetadataAddStr(where_exp_tags, PS_LIST_TAIL, "exp_tag",
-                PS_META_DUPLICATE_OK, "==", row->exp_tag)
+        if (!psMetadataAddS64(where_exp_ids, PS_LIST_TAIL, "exp_id",
+                PS_META_DUPLICATE_OK, "==", row->exp_id)
         ) {
-            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
+            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
             psFree(detInputExp);
-            psFree(where_exp_tags);
+            psFree(where_exp_ids);
             return NULL;
         }
@@ -2247,8 +2247,8 @@
     psFree(detInputExp);
 
-    // select rawImfiles with matching exp_tags
+    // select rawImfiles with matching exp_ids
     psArray *rawImfiles =
-        rawImfileSelectRowObjects(config->dbh, where_exp_tags, 0);
-    psFree(where_exp_tags);
+        rawImfileSelectRowObjects(config->dbh, where_exp_ids, 0);
+    psFree(where_exp_ids);
     if (!rawImfiles) {
         psError(PS_ERR_UNKNOWN, false, "no rawImfile rows found");
@@ -2263,5 +2263,5 @@
     PS_ASSERT_PTR_NON_NULL(config, false);
 
-    // det_id, exp_tag, class_id, uri, recipe, -bg, -bg_stdev
+    // det_id, exp_id, class_id, uri, recipe, -bg, -bg_stdev
     // are required
     bool status = false;
@@ -2275,11 +2275,11 @@
         return 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");
+    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");
         return false;
     }
@@ -2384,8 +2384,8 @@
     }
 
-    // find the matching rawImfile by exp_tag/class_id
+    // find the matching rawImfile by exp_id/class_id
     psMetadata *where = psMetadataAlloc();
-    if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", exp_tag)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
+    if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==", exp_id)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
         psFree(where);
         return false;
@@ -2415,5 +2415,5 @@
     detProcessedImfileRow *detRow = detProcessedImfileRowAlloc(
         (psS32)atol(det_id),
-        exp_tag,
+        (psS64)atoll(exp_id),
         class_id,
         uri,
@@ -2461,10 +2461,10 @@
     // select detRun.iteration
     // select detRun.det_type
-    // select detProcessedImfile.exp_tag
+    // select detProcessedImfile.exp_id
     // by:
     // find the current iteration bassed on det_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
+    // 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
     // found how many imfile there are in each class_id
     // and:
@@ -2477,5 +2477,5 @@
         "    iteration,"
         "    det_type,"
-        "    exp_tag,"
+        "    exp_id,"
         "    camera,"
         "    workdir"
@@ -2486,5 +2486,5 @@
         "    detRun.det_type,"
         "    detRun.workdir,"
-        "    detProcessedImfile.exp_tag,"
+        "    detProcessedImfile.exp_id,"
         "    rawExp.camera,"
         "    detProcessedImfile.class_id,"
@@ -2494,14 +2494,14 @@
         "   USING(det_id, iteration)"
         " JOIN rawExp"
-        "   ON detInputExp.exp_tag = rawExp.exp_tag"
+        "   ON detInputExp.exp_id = rawExp.exp_id"
         " JOIN rawImfile"
-        "   ON rawExp.exp_tag = rawImfile.exp_tag"
+        "   ON rawExp.exp_id = rawImfile.exp_id"
         " LEFT JOIN detProcessedImfile"
         "   ON detRun.det_id = detProcessedImfile.det_id"
-        "   AND detInputExp.exp_tag = detProcessedImfile.exp_tag"
+        "   AND detInputExp.exp_id = detProcessedImfile.exp_id"
         "   AND rawImfile.class_id = detProcessedImfile.class_id"
         " LEFT JOIN detProcessedExp"
         "   ON detProcessedImfile.det_id = detProcessedExp.det_id"
-        "   AND detProcessedImfile.exp_tag = detProcessedExp.exp_tag"
+        "   AND detProcessedImfile.exp_id = detProcessedExp.exp_id"
         " WHERE"
         "   detRun.state = 'run'"
@@ -2509,8 +2509,8 @@
         "   AND detProcessedImfile.fault = 0"
         "   AND detProcessedExp.det_id IS NULL"
-        "   AND detProcessedExp.exp_tag IS NULL"
+        "   AND detProcessedExp.exp_id IS NULL"
         "   AND detInputExp.include = 1"
         " GROUP BY"
-        "    rawExp.exp_tag,"
+        "    rawExp.exp_id,"
         "    detRun.det_id"
         " HAVING"
@@ -2579,5 +2579,5 @@
     PS_ASSERT_PTR_NON_NULL(config, false);
 
-    // det_id, exp_tag, recip, -bg, -bg_stdev
+    // det_id, exp_id, recip, -bg, -bg_stdev
     // are required
     bool status = false;
@@ -2591,11 +2591,11 @@
         return 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");
+    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");
         return false;
     }
@@ -2693,5 +2693,5 @@
         "    detRun.iteration,"
         "    detRun.det_type,"
-        "    detProcessedImfile.exp_tag"
+        "    detProcessedImfile.exp_id"
         " FROM detRun"
         " JOIN detInputExp"
@@ -2699,13 +2699,13 @@
         "    AND detRun.iteration = detInputExp.iteration"
         " JOIN rawExp"
-        "    ON detInputExp.exp_tag = rawExp.exp_tag"
+        "    ON detInputExp.exp_id = rawExp.exp_id"
         " JOIN detProcessedImfile"
         "    ON detInputExp.det_id = detProcessedImfile.det_id"
-        "    AND detInputExp.exp_tag = detProcessedImfile.exp_tag"
+        "    AND detInputExp.exp_id = detProcessedImfile.exp_id"
         " LEFT JOIN detProcessedExp"
         "    ON detInputExp.det_id = detProcessedExp.det_id"
-        "    AND detProcessedImfile.exp_tag= detProcessedExp.exp_tag"
+        "    AND detProcessedImfile.exp_id= detProcessedExp.exp_id"
         " LEFT JOIN rawImfile"
-        "    ON detInputExp.exp_tag = rawImfile.exp_tag"
+        "    ON detInputExp.exp_id = rawImfile.exp_id"
         "    AND detProcessedImfile.class_id = rawImfile.class_id"
         " WHERE"
@@ -2713,8 +2713,8 @@
         "   AND detRun.mode = 'master'"
         "   AND detProcessedExp.det_id IS NULL"
-        "   AND detProcessedExp.exp_tag IS NULL"
+        "   AND detProcessedExp.exp_id IS NULL"
         "   AND detInputExp.include = 1"
         "   AND detRun.det_id = %s"
-        "   AND detProcessedImfile.exp_tag = '%s'"
+        "   AND detProcessedImfile.exp_id = '%s'"
         " GROUP BY"
         "    detProcessedImfile.class_id,"
@@ -2725,5 +2725,5 @@
         );
 
-    if (!p_psDBRunQuery(config->dbh, query, det_id, exp_tag)) {
+    if (!p_psDBRunQuery(config->dbh, query, det_id, exp_id)) {
         psError(PS_ERR_UNKNOWN, false, "database error");
         psFree(query);
@@ -2747,5 +2747,5 @@
     detProcessedExpRow *detRow = detProcessedExpRowAlloc(
         (psS32)atol(det_id),
-        exp_tag,
+        (psS64)atoll(exp_id),
         recipe,
         bg,
@@ -2872,7 +2872,7 @@
     // by:
     // find the current iteration bassed on det_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
+    // 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
     // found how many imfile there are in each class_id
     // and:
@@ -2895,10 +2895,10 @@
         "    AND detRun.iteration = detInputExp.iteration\n"
         " JOIN rawExp\n"
-        "    ON detInputExp.exp_tag = rawExp.exp_tag\n"
+        "    ON detInputExp.exp_id = rawExp.exp_id\n"
         " JOIN rawImfile\n"
-        "    ON detInputExp.exp_tag = rawImfile.exp_tag\n"
+        "    ON detInputExp.exp_id = rawImfile.exp_id\n"
         " LEFT JOIN detProcessedImfile\n"
         "    ON detInputExp.det_id = detProcessedImfile.det_id\n"
-        "    AND detInputExp.exp_tag = detProcessedImfile.exp_tag\n"
+        "    AND detInputExp.exp_id = detProcessedImfile.exp_id\n"
         "    AND rawImfile.class_id = detProcessedImfile.class_id\n"
         " LEFT JOIN detStackedImfile\n"
@@ -3007,7 +3007,7 @@
         "   ON detRun.det_id = detInputExp.det_id"
         "   AND detRun.iteration = detInputExp.iteration"
-        "   AND detProcessedImfile.exp_tag = detInputExp.exp_tag"
+        "   AND detProcessedImfile.exp_id = detInputExp.exp_id"
         " JOIN rawExp"
-        "   ON rawExp.exp_tag = detProcessedImfile.exp_tag"
+        "   ON rawExp.exp_id = detProcessedImfile.exp_id"
         " WHERE"
     );
@@ -3213,5 +3213,5 @@
     if (!psMetadataAddS32(where, PS_LIST_TAIL, "det_id", 0, "==",
             (psS64)atoll(det_id))) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
+        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
         psFree(where);
         return false;
@@ -3377,5 +3377,5 @@
     // by:
     // find the current iteration bassed on det_id
-    // find all exp_tags in the current det_id/iteration from detInputExp
+    // find all exp_ids 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
@@ -3407,5 +3407,5 @@
         "   AND detRun.iteration = detInputExp.iteration"
         " JOIN rawExp"
-        "   ON detInputExp.exp_tag = rawExp.exp_tag"
+        "   ON detInputExp.exp_id = rawExp.exp_id"
         " JOIN detStackedImfile"
         "   ON detInputExp.det_id = detStackedImfile.det_id"
@@ -3423,5 +3423,5 @@
         "   AND detNormalizedStatImfile.class_id IS NULL"
         " GROUP BY"
-        "   rawExp.exp_tag,"
+        "   rawExp.exp_id,"
         "   detRun.iteration,"
         "   detRun.det_id"
@@ -3633,5 +3633,5 @@
         "   USING(det_id, iteration)"
         " JOIN rawExp"
-        "   ON detInputExp.exp_tag = rawExp.exp_tag"
+        "   ON detInputExp.exp_id = rawExp.exp_id"
         " JOIN detNormalizedStatImfile"
         "   ON detStackedImfile.det_id = detNormalizedStatImfile.det_id"
@@ -3774,8 +3774,8 @@
         psMetadata *where = psMetadataAlloc();
         for (long i = 0; i < psArrayLength(inputExps); i++) {
-            if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag",
+            if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id",
                     PS_META_DUPLICATE_OK, "==",
-                    ((detInputExpRow *)inputExps->data[i])->exp_tag)) {
-                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
+                    ((detInputExpRow *)inputExps->data[i])->exp_id)) {
+                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
                 psFree(inputExps);
                 psFree(where);
@@ -3963,10 +3963,10 @@
         "    AND detRun.iteration = detInputExp.iteration"
         " JOIN rawExp"
-        "    ON detInputExp.exp_tag = rawExp.exp_tag"
+        "    ON detInputExp.exp_id = rawExp.exp_id"
         " JOIN detNormalizedImfile"
         "    ON detInputExp.det_id = detNormalizedImfile.det_id"
         "    AND detInputExp.iteration = detNormalizedImfile.iteration"
         " LEFT JOIN rawImfile"
-        "    ON detInputExp.exp_tag = rawImfile.exp_tag"
+        "    ON detInputExp.exp_id = rawImfile.exp_id"
         "    AND detNormalizedImfile.class_id = rawImfile.class_id"
         " LEFT JOIN detNormalizedExp"
@@ -4152,10 +4152,10 @@
         "    AND detRun.iteration = detInputExp.iteration"
         " JOIN rawExp"
-        "    ON detInputExp.exp_tag = rawExp.exp_tag"
+        "    ON detInputExp.exp_id = rawExp.exp_id"
         " JOIN detNormalizedImfile"
         "    ON detInputExp.det_id = detNormalizedImfile.det_id"
         "    AND detInputExp.iteration = detNormalizedImfile.iteration"
         " LEFT JOIN rawImfile"
-        "    ON detInputExp.exp_tag = rawImfile.exp_tag"
+        "    ON detInputExp.exp_id = rawImfile.exp_id"
         "    AND detNormalizedImfile.class_id = rawImfile.class_id"
         " LEFT JOIN detNormalizedExp"
@@ -4437,5 +4437,5 @@
         "   detRun.workdir,\n"
         "   detRun.reduction,\n"
-        "   detProcessedImfile.exp_tag,\n"
+        "   detProcessedImfile.exp_id,\n"
         "   detProcessedImfile.class_id,\n"
         "   detProcessedImfile.uri,\n"
@@ -4446,8 +4446,8 @@
         "   USING(det_id, iteration)\n"
         " JOIN rawExp\n"
-        "   ON detInputExp.exp_tag = rawExp.exp_tag\n"
+        "   ON detInputExp.exp_id = rawExp.exp_id\n"
         " JOIN detProcessedImfile\n"
         "   ON detRun.det_id = detProcessedImfile.det_id\n"
-        "   AND detInputExp.exp_tag = detProcessedImfile.exp_tag\n"
+        "   AND detInputExp.exp_id = detProcessedImfile.exp_id\n"
         " JOIN detNormalizedImfile\n"
         "   ON detRun.det_id = detNormalizedImfile.det_id\n"
@@ -4457,5 +4457,5 @@
         "   ON detRun.det_id = detResidImfile.det_id\n"
         "   AND detRun.iteration = detResidImfile.iteration\n"
-        "   AND detProcessedImfile.exp_tag = detResidImfile.exp_tag\n"
+        "   AND detProcessedImfile.exp_id = detResidImfile.exp_id\n"
         "   AND detProcessedImfile.class_id = detResidImfile.class_id\n"
         " WHERE\n"
@@ -4465,5 +4465,5 @@
         "   AND detResidImfile.det_id IS NULL\n"
         "   AND detResidImfile.iteration IS NULL\n"
-        "   AND detResidImfile.exp_tag IS NULL\n"
+        "   AND detResidImfile.exp_id IS NULL\n"
         "   AND detResidImfile.class_id IS NULL\n"
         " UNION"
@@ -4475,5 +4475,5 @@
         "   detRun.workdir,\n"
         "   detRun.reduction,\n"
-        "   rawImfile.exp_tag,\n"
+        "   rawImfile.exp_id,\n"
         "   rawImfile.class_id,\n"
         "   rawImfile.uri,\n"
@@ -4484,11 +4484,11 @@
         "    USING(det_id, iteration)\n"
         " JOIN rawExp\n"
-        "    ON detInputExp.exp_tag = rawExp.exp_tag\n"
+        "    ON detInputExp.exp_id = rawExp.exp_id\n"
         " JOIN rawImfile\n"
-        "    ON detInputExp.exp_tag = rawImfile.exp_tag\n"
+        "    ON detInputExp.exp_id = rawImfile.exp_id\n"
         " LEFT JOIN detResidImfile\n"
         "   ON detRun.det_id = detResidImfile.det_id\n"
         "   AND detRun.iteration = detResidImfile.iteration\n"
-        "   AND rawImfile.exp_tag = detResidImfile.exp_tag\n"
+        "   AND rawImfile.exp_id = detResidImfile.exp_id\n"
         "   AND rawImfile.class_id = detResidImfile.class_id\n"
         " WHERE\n"
@@ -4497,5 +4497,5 @@
         "   AND detResidImfile.det_id IS NULL\n"
         "   AND detResidImfile.iteration IS NULL\n"
-        "   AND detResidImfile.exp_tag IS NULL\n"
+        "   AND detResidImfile.exp_id IS NULL\n"
         "   AND detResidImfile.class_id IS NULL\n"
         );
@@ -4658,5 +4658,5 @@
 
     // make sure that there is a coresponding entry in detNormalizedImfile
-    // and the exp_tag specified is valid
+    // and the exp_id specified is valid
     // select * from detNormalizedImfile
     // by det_id, iteration, class_id
@@ -4674,5 +4674,5 @@
         "   ON detRun.det_id = detResidImfile.det_id\n"
         "   AND detRun.iteration = detResidImfile.iteration\n"
-        "   AND detInputExp.exp_tag = detResidImfile.exp_tag\n"
+        "   AND detInputExp.exp_id = detResidImfile.exp_id\n"
         "   AND detNormalizedImfile.class_id = detResidImfile.class_id\n"
         " WHERE\n"
@@ -4681,5 +4681,5 @@
         "  AND detResidImfile.det_id IS NULL\n"
         "  AND detResidImfile.iteration IS NULL\n"
-        "  AND detResidImfile.exp_tag IS NULL\n"
+        "  AND detResidImfile.exp_id IS NULL\n"
         "  AND detResidImfile.class_id IS NULL\n"
         " UNION\n"
@@ -4703,11 +4703,11 @@
         "    USING(det_id, iteration)\n"
         " JOIN rawExp\n"
-        "    ON detInputExp.exp_tag = rawExp.exp_tag\n"
+        "    ON detInputExp.exp_id = rawExp.exp_id\n"
         " JOIN rawImfile\n"
-        "    ON detInputExp.exp_tag = rawImfile.exp_tag\n"
+        "    ON detInputExp.exp_id = rawImfile.exp_id\n"
         " LEFT JOIN detResidImfile\n"
         "   ON detRun.det_id = detResidImfile.det_id\n"
         "   AND detRun.iteration = detResidImfile.iteration\n"
-        "   AND rawImfile.exp_tag = detResidImfile.exp_tag\n"
+        "   AND rawImfile.exp_id = detResidImfile.exp_id\n"
         "   AND rawImfile.class_id = detResidImfile.class_id\n"
         " WHERE\n"
@@ -4716,7 +4716,7 @@
         "   AND detResidImfile.det_id IS NULL\n"
         "   AND detResidImfile.iteration IS NULL\n"
-        "   AND detResidImfile.exp_tag IS NULL\n"
+        "   AND detResidImfile.exp_id IS NULL\n"
         "   AND detResidImfile.class_id IS NULL\n"
-        "   AND detInputExp.exp_tag = '%1$s'\n"
+        "   AND detInputExp.exp_id = '%1$s'\n"
         ") AS foo\n"
         "  %2$s"
@@ -4776,15 +4776,15 @@
     psFree(where);
 
-    // exp_tag is manadatory to cross check that this is a exp_tag for this
+    // exp_id is manadatory to cross check that this is a exp_id for this
     // detRun
-    psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
+    psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
         psFree(whereClause);
         psFree(query);
         return false;
     }
-    if (!exp_tag) {
-        psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
+    if (!exp_id) {
+        psError(PS_ERR_UNKNOWN, true, "-exp_id is required");
         psFree(whereClause);
         psFree(query);
@@ -4792,5 +4792,5 @@
     }
 
-    if (!p_psDBRunQuery(config->dbh, query, exp_tag, whereClause)) {
+    if (!p_psDBRunQuery(config->dbh, query, exp_id, whereClause)) {
         psError(PS_ERR_UNKNOWN, false, "database error");
         psFree(whereClause);
@@ -4862,11 +4862,11 @@
 
     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");
+    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");
         return false;
     }
@@ -4979,5 +4979,5 @@
             normalizedImfile->det_id,
             normalizedImfile->iteration,
-            exp_tag,
+            (psS64)atoll(exp_id),
             normalizedImfile->class_id,
             uri,
@@ -5020,5 +5020,5 @@
     // select detResidImfile.*
     // by:
-    // where det_id, iteration, exp_tag is not in detResidExp;
+    // where det_id, iteration, exp_id is not in detResidExp;
 
     psString query = psStringCopy(
@@ -5032,5 +5032,5 @@
         "   USING(det_id, iteration)"
         " JOIN rawExp"
-        "   USING(exp_tag)"
+        "   USING(exp_id)"
         " WHERE"
     );
@@ -5128,12 +5128,12 @@
     // select detRun.iteration
     // select detRun.det_type
-    // select detInputExp.exp_tag
+    // select detInputExp.exp_id
     // select detInputExp.include
     // by:
     // find the current iteration bassed on det_id
-    // find all exp_tags in the current det_id/iteration from detInputExp
+    // find all exp_ids in the current det_id/iteration from detInputExp
     // compare to detInputExp.imfiles to derResidImfile by class_id
     // and:
-    // detResidImfile.{det_id, iteration, exp_tag} is not in detResidExp
+    // detResidImfile.{det_id, iteration, exp_id} is not in detResidExp
 
     psString query = psStringCopy(
@@ -5143,5 +5143,5 @@
         "   det_type,\n"
         "   mode,\n"
-        "   exp_tag,\n"
+        "   exp_id,\n"
         "   include,\n"
         "   camera,\n"
@@ -5154,5 +5154,5 @@
         "       detRun.mode,\n"
         "       detRun.workdir,\n"
-        "       detInputExp.exp_tag,\n"
+        "       detInputExp.exp_id,\n"
         "       detInputExp.include,\n"
         "       rawExp.imfiles,\n"
@@ -5163,13 +5163,13 @@
         "       USING(det_id, iteration)\n"
         "   JOIN rawExp\n"
-        "       ON detInputExp.exp_tag = rawExp.exp_tag\n"
+        "       ON detInputExp.exp_id = rawExp.exp_id\n"
         "   JOIN detResidImfile\n"
         "       ON detRun.det_id = detResidImfile.det_id\n"
         "       AND detRun.iteration = detResidImfile.iteration\n"
-        "       AND detInputExp.exp_tag = detResidImfile.exp_tag\n"
+        "       AND detInputExp.exp_id = detResidImfile.exp_id\n"
         "   LEFT JOIN detResidExp\n"
         "       ON detResidImfile.det_id = detResidExp.det_id\n"
         "       AND detResidImfile.iteration = detResidExp.iteration\n"
-        "       AND detResidImfile.exp_tag = detResidExp.exp_tag\n"
+        "       AND detResidImfile.exp_id = detResidExp.exp_id\n"
         "   WHERE\n"
         "       detRun.state = 'run'\n"
@@ -5177,7 +5177,7 @@
         "       AND detResidExp.det_id IS NULL\n"
         "       AND detResidExp.iteration IS NULL\n"
-        "       AND detResidExp.exp_tag IS NULL\n"
+        "       AND detResidExp.exp_id IS NULL\n"
         "   GROUP BY\n"
-        "       detInputExp.exp_tag,\n"
+        "       detInputExp.exp_id,\n"
         "       detRun.iteration,\n"
         "       detRun.det_id\n"
@@ -5258,12 +5258,12 @@
     // select detRun.iteration
     // select detRun.det_type
-    // select detInputExp.exp_tag
+    // select detInputExp.exp_id
     // select detInputExp.include
     // by:
     // find the current iteration bassed on det_id
-    // find all exp_tags in the current det_id/iteration from detInputExp
+    // find all exp_ids in the current det_id/iteration from detInputExp
     // compare to detInputExp.imfiles to derResidImfile by class_id
     // and:
-    // detResidImfile.{det_id, iteration, exp_tag} is not in detResidExp
+    // detResidImfile.{det_id, iteration, exp_id} is not in detResidExp
 
     psString query = psStringCopy(
@@ -5271,5 +5271,5 @@
         "   det_id,"
         "   iteration,"
-        "   exp_tag,"
+        "   exp_id,"
         "   include"
         " FROM"
@@ -5278,5 +5278,5 @@
         "       detRun.iteration,"
         "       detRun.det_type,"
-        "       detInputExp.exp_tag,"
+        "       detInputExp.exp_id,"
         "       detInputExp.include,"
         "       rawExp.imfiles"
@@ -5285,20 +5285,20 @@
         "       USING(det_id, iteration)"
         "   JOIN rawExp"
-        "       ON detInputExp.exp_tag = rawExp.exp_tag"
+        "       ON detInputExp.exp_id = rawExp.exp_id"
         "   JOIN detResidImfile"
         "       ON detRun.det_id = detResidImfile.det_id"
         "       AND detRun.iteration = detResidImfile.iteration"
-        "       AND detInputExp.exp_tag = detResidImfile.exp_tag"
+        "       AND detInputExp.exp_id = detResidImfile.exp_id"
         "   LEFT JOIN detResidExp"
         "       ON detResidImfile.det_id = detResidExp.det_id"
         "       AND detResidImfile.iteration = detResidExp.iteration"
-        "       AND detResidImfile.exp_tag = detResidExp.exp_tag"
+        "       AND detResidImfile.exp_id = detResidExp.exp_id"
         "   WHERE"
         "       detRun.state = 'run'"
         "       AND detResidExp.det_id IS NULL"
         "       AND detResidExp.iteration IS NULL"
-        "       AND detResidExp.exp_tag IS NULL"
+        "       AND detResidExp.exp_id IS NULL"
         "   GROUP BY"
-        "       detInputExp.exp_tag,"
+        "       detInputExp.exp_id,"
         "       detRun.iteration,"
         "       detRun.det_id"
@@ -5309,5 +5309,5 @@
 
     {
-        // build a query to search by det_id, iteration, exp_tag
+        // build a query to search by det_id, iteration, exp_id
         psMetadata *where = psMetadataAlloc();
         bool status = false;
@@ -5342,14 +5342,14 @@
             return false;
         }
-        psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
-        if (!status) {
-            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
+        psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
+        if (!status) {
+            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
             psFree(where);
             psFree(query);
             return false;
         }
-        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");
+        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");
                 psFree(where);
                 psFree(query);
@@ -5448,11 +5448,11 @@
         return false;
     }
-    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");
+    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");
         return false;
     }
@@ -5565,5 +5565,5 @@
             det_id,
             iteration,
-            exp_tag,
+            (psS64)atoll(exp_id),
             recipe,
             bg,
@@ -5611,5 +5611,5 @@
         "   USING(det_id, iteration)"
         " JOIN detResidExp"
-        "   USING(det_id, iteration, exp_tag)"
+        "   USING(det_id, iteration, exp_id)"
         " WHERE"
         "   detRun.state = 'run'"
@@ -5697,7 +5697,7 @@
     // by:
     // find the current iteration bassed on det_id
-    // 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
+    // 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
 
     psString query = psStringCopy(
@@ -5716,5 +5716,5 @@
         "       detRun.mode,\n"
         "       detRun.workdir,\n"
-        "       detInputExp.exp_tag,\n"
+        "       detInputExp.exp_id,\n"
         "       rawExp.camera\n"
         "   FROM detRun\n"
@@ -5722,9 +5722,9 @@
         "       USING(det_id, iteration)\n"
         "   JOIN rawExp\n"
-        "       ON detInputExp.exp_tag = rawExp.exp_tag\n"
+        "       ON detInputExp.exp_id = rawExp.exp_id\n"
         "   LEFT JOIN detResidExp\n"
         "       ON detRun.det_id = detResidExp.det_id\n"
         "       AND detRun.iteration = detResidExp.iteration\n"
-        "       AND detInputExp.exp_tag = detResidExp.exp_tag\n"
+        "       AND detInputExp.exp_id = detResidExp.exp_id\n"
         "   WHERE\n"
         "       detRun.state = 'run'\n"
@@ -5733,5 +5733,5 @@
         "       detRun.iteration\n"
         "   HAVING\n"
-        "       COUNT(detResidExp.exp_tag) = COUNT(detInputExp.exp_tag)\n"
+        "       COUNT(detResidExp.exp_id) = COUNT(detInputExp.exp_id)\n"
         " ) AS residdetrun\n"
         );
@@ -5797,5 +5797,5 @@
     PS_ASSERT_PTR_NON_NULL(config, false);
 
-    // build a query to search by det_id, iteration, exp_tag
+    // build a query to search by det_id, iteration, exp_id
     psMetadata *where = psMetadataAlloc();
     bool status = false;
@@ -5825,13 +5825,13 @@
         return false;
     }
-    psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
+    psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
         psFree(where);
         return false;
     }
-    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");
+    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");
             psFree(where);
             return false;
@@ -5840,5 +5840,5 @@
 
     // find the values we're going to set
-    // copy everything but det_id, iteration, & exp_tag from the args and
+    // copy everything but det_id, iteration, & exp_id from the args and
     // remove the '-' prefix
     psMetadata *set = psMetadataAlloc();
@@ -5957,7 +5957,7 @@
     // by:
     // find the current iteration bassed on det_id
-    // 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
+    // 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
 
     psString query = pxDataGet("dettool_find_completed_runs.sql");
@@ -5968,5 +5968,5 @@
 
     {
-        // build a query to search by det_id, iteration, exp_tag
+        // build a query to search by det_id, iteration, exp_id
         psMetadata *where = psMetadataAlloc();
         bool status = false;
@@ -6271,11 +6271,11 @@
     // select detRun.det_id
     // select detRun.iteration
-    // select detInputExp.exp_tag
+    // select detInputExp.exp_id
     // select detResidExp.accept
     // by:
     // find the current iteration bassed on det_id
-    // 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
+    // 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
 
     psString query = psStringCopy(
@@ -6283,5 +6283,5 @@
         "   detRun.det_id AS det_id,"
         "   detRun.iteration,"
-        "   detInputExp.exp_tag,"
+        "   detInputExp.exp_id,"
         "   detResidExp.accept"
         " FROM detRun"
@@ -6292,5 +6292,5 @@
         "   ON detRun.det_id = detResidExp.det_id"
         "   AND detRun.iteration = detResidExp.iteration"
-        "   AND detInputExp.exp_tag = detResidExp.exp_tag"
+        "   AND detInputExp.exp_id = detResidExp.exp_id"
         " WHERE"
         "   detRun.state = 'run'"
@@ -6310,7 +6310,7 @@
         "   detRun.det_id,"
         "   detRun.iteration,"
-        "   detInputExp.exp_tag"
+        "   detInputExp.exp_id"
         " HAVING"
-        "   COUNT(detResidExp.exp_tag) = COUNT(detInputExp.exp_tag)"
+        "   COUNT(detResidExp.exp_id) = COUNT(detInputExp.exp_id)"
         );
 
@@ -6357,5 +6357,5 @@
     for (long i = 0; i < psArrayLength(output); i++) {
         psMetadata *row = output->data[i];
-        psString exp_tag = psMetadataLookupStr(&status, row, "exp_tag");
+        psString exp_id = psMetadataLookupStr(&status, row, "exp_id");
         if (!status) {
             // rollback
@@ -6363,5 +6363,5 @@
                 psError(PS_ERR_UNKNOWN, false, "database error");
             }
-            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for exp_tag");
+            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for exp_id");
             psFree(output);
             return false;
@@ -6383,5 +6383,5 @@
                     (psS32)atol(det_id),
                     newIteration,
-                    exp_tag,
+                    (psS64)atoll(exp_id),
                     accept
                 )
@@ -6424,15 +6424,15 @@
     }
 
-    // we have to support multipe exp_tags
-    psMetadataItem *item = psMetadataLookup(config->args, "-exp_tag");
+    // we have to support multipe exp_ids
+    psMetadataItem *item = psMetadataLookup(config->args, "-exp_id");
     if (!item) {
         // this shouldn't actually happen when using psArgs
-        psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
-        return false;
-    }
-
-    psList *exp_tag_list = item->data.list;
+        psError(PS_ERR_UNKNOWN, true, "-exp_id is required");
+        return false;
+    }
+
+    psList *exp_id_list = item->data.list;
     psMetadata *where = psMetadataAlloc();
-    // make sure that -exp_tag was parsed correctly
+    // make sure that -exp_id was parsed correctly
     // XXX this can be removed someday
     if (item->type == PS_DATA_METADATA_MULTI) {
@@ -6440,17 +6440,17 @@
         psMetadataItem *mItem = NULL;
         while ((mItem = psListGetAndIncrement(iter))) {
-            psString exp_tag = mItem->data.V;
-            // if exp_tag is NULL then it means that -exp_tag has not been
+            psString exp_id = mItem->data.V;
+            // if exp_id is NULL then it means that -exp_id has not been
             // specified
-            if (!exp_tag) {
+            if (!exp_id) {
                 psError(PS_ERR_UNKNOWN, true,
-                        "at least one -exp_tag is required");
+                        "at least one -exp_id is required");
                 psFree(where);
                 return false;
             }
 
-            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");
+            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");
                 psFree(iter);
                 psFree(where);
@@ -6460,8 +6460,8 @@
         psFree(iter);
     } else {
-        psAbort(                "-exp_tag was not parsed correctly (this should not happen");
-    }
-
-    // check that the specified exp_tags actually exist in the iteration zero
+        psAbort(                "-exp_id was not parsed correctly (this should not happen");
+    }
+
+    // check that the specified exp_ids actually exist in the iteration zero
     // detInputExp set
 
@@ -6487,12 +6487,15 @@
     }
 
-    // build a hash for the valid exp_tags
-    psHash *valid_exp_tags = psHashAlloc(psArrayLength(detrendExps));
+    // build a hash for the valid exp_ids
+    psHash *valid_exp_ids = psHashAlloc(psArrayLength(detrendExps));
+// XXX: FIXME!
+#if 0
     for (long i = 0; i < psArrayLength(detrendExps); i++) {
-        psHashAdd(valid_exp_tags,
-            ((detInputExpRow *)detrendExps->data[i])->exp_tag,
+        psHashAdd(valid_exp_ids,
+            ((detInputExpRow *)detrendExps->data[i])->exp_id,
             detrendExps->data[i]
         );
     }
+#endif
     psFree(detrendExps);
 
@@ -6501,5 +6504,5 @@
     if (!psDBTransaction(config->dbh)) {
         psError(PS_ERR_UNKNOWN, false, "database error");
-        psFree(valid_exp_tags);
+        psFree(valid_exp_ids);
         return false;
     }
@@ -6512,15 +6515,15 @@
             psError(PS_ERR_UNKNOWN, false, "database error");
         }
-        psFree(valid_exp_tags);
-        return false;
-    }
-
-    // check exp_tags and build up an array of new detInputExp rows at the same
+        psFree(valid_exp_ids);
+        return false;
+    }
+
+    // check exp_ids and build up an array of new detInputExp rows at the same
     // time
-    psListIterator *iter = psListIteratorAlloc(exp_tag_list, 0, false);
+    psListIterator *iter = psListIteratorAlloc(exp_id_list, 0, false);
     psMetadataItem *mItem = NULL;
-    psArray *newInputExps = psArrayAllocEmpty(psListLength(exp_tag_list));
+    psArray *newInputExps = psArrayAllocEmpty(psListLength(exp_id_list));
     while ((mItem = psListGetAndIncrement(iter))) {
-        detInputExpRow *inputExp = psHashLookup(valid_exp_tags,
+        detInputExpRow *inputExp = psHashLookup(valid_exp_ids,
                 (char *)mItem->data.V);
         if (!inputExp) {
@@ -6529,9 +6532,9 @@
                 psError(PS_ERR_UNKNOWN, false, "database error");
             }
-            // invalid exp_tag
-            psError(PS_ERR_UNKNOWN, false, "exp_tag %s is invalid for det_id %s",
+            // invalid exp_id
+            psError(PS_ERR_UNKNOWN, false, "exp_id %s is invalid for det_id %s",
                     (char *)mItem->data.V, det_id);
             psFree(iter);
-            psFree(valid_exp_tags);
+            psFree(valid_exp_ids);
             return false;
         }
@@ -6539,5 +6542,5 @@
             (psS32)atol(det_id),
             newIteration,
-            inputExp->exp_tag,
+            inputExp->exp_id,
             true   // use
         );
@@ -6546,5 +6549,5 @@
     }
     psFree(iter);
-    psFree(valid_exp_tags);
+    psFree(valid_exp_ids);
 
     for (long i = 0; i < psArrayLength(newInputExps); i++) {
Index: trunk/ippTools/src/dettoolConfig.c
===================================================================
--- trunk/ippTools/src/dettoolConfig.c	(revision 14018)
+++ trunk/ippTools/src/dettoolConfig.c	(revision 14023)
@@ -49,5 +49,5 @@
     // -pending
     psMetadata *pendingArgs = psMetadataAlloc();
-    psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-exp_tag",  0,
+    psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-exp_id",  0,
             "search by exposure ID", NULL);
     psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-exp_type",  0,
@@ -66,5 +66,5 @@
     // -definebytag
     psMetadata *definebytagArgs = psMetadataAlloc();
-    psMetadataAddStr(definebytagArgs, PS_LIST_TAIL, "-exp_tag",
+    psMetadataAddStr(definebytagArgs, PS_LIST_TAIL, "-exp_id",
             PS_META_DUPLICATE_OK,
             "include this exposure (multiple OK, required)", NULL);
@@ -292,5 +292,5 @@
     psMetadataAddS32(inputArgs, PS_LIST_TAIL, "-iteration",  0,
             "define iteration number", 0);
-    psMetadataAddStr(inputArgs, PS_LIST_TAIL, "-exp_tag",  0,
+    psMetadataAddStr(inputArgs, PS_LIST_TAIL, "-exp_id",  0,
             "search for exp ID", NULL);
     psMetadataAddBool(inputArgs, PS_LIST_TAIL, "-simple",  0,
@@ -306,5 +306,5 @@
     psMetadataAddStr(toprocessedimfileArgs, PS_LIST_TAIL, "-det_id",  0,
             "search for detrend ID", NULL);
-    psMetadataAddStr(toprocessedimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
+    psMetadataAddStr(toprocessedimfileArgs, PS_LIST_TAIL, "-exp_id",  0,
             "search for exp ID", NULL);
     psMetadataAddStr(toprocessedimfileArgs, PS_LIST_TAIL, "-class_id",  0,
@@ -319,5 +319,5 @@
     psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-det_id",  0,
             "define detrend ID (required)", NULL);
-    psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
+    psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-exp_id",  0,
             "define exp ID (required)", NULL);
     psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-class_id",  0,
@@ -358,5 +358,5 @@
     psMetadataAddStr(processedimfileArgs, PS_LIST_TAIL, "-det_id",  0,
             "search for detrend ID", NULL);
-    psMetadataAddStr(processedimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
+    psMetadataAddStr(processedimfileArgs, PS_LIST_TAIL, "-exp_id",  0,
             "search for exp ID", NULL);
     psMetadataAddStr(processedimfileArgs, PS_LIST_TAIL, "-class_id",  0,
@@ -390,5 +390,5 @@
     psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-det_id",  0,
             "define detrend ID (required)", NULL);
-    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-exp_tag",  0,
+    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-exp_id",  0,
             "define detrend ID (required)", NULL);
     psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-recip",  0,
@@ -425,5 +425,5 @@
     psMetadataAddStr(processedexpArgs, PS_LIST_TAIL, "-det_id",  0,
             "define detrend ID", NULL);
-    psMetadataAddStr(processedexpArgs, PS_LIST_TAIL, "-exp_tag",  0,
+    psMetadataAddStr(processedexpArgs, PS_LIST_TAIL, "-exp_id",  0,
             "define detrend ID", NULL);
     psMetadataAddU64(processedexpArgs, PS_LIST_TAIL, "-limit",  0,
@@ -645,5 +645,5 @@
     psMetadataAddS32(addresidimfileArgs, PS_LIST_TAIL, "-iteration",  0,
             "define iteration number", 0);
-    psMetadataAddStr(addresidimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
+    psMetadataAddStr(addresidimfileArgs, PS_LIST_TAIL, "-exp_id",  0,
             "define detrend ID (required)", NULL);
     psMetadataAddStr(addresidimfileArgs, PS_LIST_TAIL, "-class_id",  0,
@@ -688,5 +688,5 @@
     psMetadataAddS32(residimfileArgs, PS_LIST_TAIL, "-iteration",  0,
             "search for iteration number", 0);
-    psMetadataAddStr(residimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
+    psMetadataAddStr(residimfileArgs, PS_LIST_TAIL, "-exp_id",  0,
             "define detrend ID", NULL);
     psMetadataAddStr(residimfileArgs, PS_LIST_TAIL, "-class_id",  0,
@@ -709,5 +709,5 @@
     psMetadataAddS32(addresidexpArgs, PS_LIST_TAIL, "-iteration",  0,
             "define iteration number", 0);
-    psMetadataAddStr(addresidexpArgs, PS_LIST_TAIL, "-exp_tag",  0,
+    psMetadataAddStr(addresidexpArgs, PS_LIST_TAIL, "-exp_id",  0,
             "define detrend ID (required)", NULL);
     psMetadataAddStr(addresidexpArgs, PS_LIST_TAIL, "-recip",  0,
@@ -750,5 +750,5 @@
     psMetadataAddS32(residexpArgs, PS_LIST_TAIL, "-iteration",  0,
             "search for iteration number", 0);
-    psMetadataAddStr(residexpArgs, PS_LIST_TAIL, "-exp_tag",  0,
+    psMetadataAddStr(residexpArgs, PS_LIST_TAIL, "-exp_id",  0,
             "search for exp ID", NULL);
     psMetadataAddStr(residexpArgs, PS_LIST_TAIL, "-recip",  0,
@@ -776,5 +776,5 @@
     psMetadataAddS32(updateresidexpArgs, PS_LIST_TAIL, "-iteration",  0,
             "define iteration number", 0);
-    psMetadataAddStr(updateresidexpArgs, PS_LIST_TAIL, "-exp_tag",  0,
+    psMetadataAddStr(updateresidexpArgs, PS_LIST_TAIL, "-exp_id",  0,
             "define exp ID", NULL);
     psMetadataAddStr(updateresidexpArgs, PS_LIST_TAIL, "-recip",  0,
@@ -834,5 +834,5 @@
     psMetadataAddStr(rerunArgs, PS_LIST_TAIL, "-det_id",  0,
             "search for detrend master for detrend ID (required)", NULL);
-    psMetadataAddStr(rerunArgs, PS_LIST_TAIL, "-exp_tag",  PS_META_DUPLICATE_OK,
+    psMetadataAddStr(rerunArgs, PS_LIST_TAIL, "-exp_id",  PS_META_DUPLICATE_OK,
             "include this exposure (multiple OK, required)", NULL);
 
@@ -999,5 +999,5 @@
     }
     addWhereStr(det_type);
-    addWhereStr(exp_tag);
+    addWhereStr(exp_id);
     addWhereStr(class_id);
     // convert '-inst' to 'camera'
Index: trunk/ippTools/src/guidetool.c
===================================================================
--- trunk/ippTools/src/guidetool.c	(revision 14018)
+++ trunk/ippTools/src/guidetool.c	(revision 14023)
@@ -185,5 +185,5 @@
 
     return guidePendingExpRowAlloc(
-        exp->exp_tag,
+        exp->exp_id,
         exp->camera,
         exp->telescope,
Index: trunk/ippTools/src/guidetoolConfig.c
===================================================================
--- trunk/ippTools/src/guidetoolConfig.c	(revision 14018)
+++ trunk/ippTools/src/guidetoolConfig.c	(revision 14023)
@@ -52,5 +52,5 @@
     // -pending search
     psMetadata *pendingArgs = psMetadataAlloc();
-    psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-exp_tag",  0,
+    psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-exp_id",  0,
         "define exposure ID", NULL);
     psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-inst",  0,
@@ -71,5 +71,5 @@
     // -define inputs
     psMetadata *defineArgs = psMetadataAlloc();
-    psMetadataAddStr(defineArgs, PS_LIST_TAIL, "-exp_tag",  0,
+    psMetadataAddStr(defineArgs, PS_LIST_TAIL, "-exp_id",  0,
         "define class", NULL);
     psMetadataAddStr(defineArgs, PS_LIST_TAIL, "-inst",  0,
@@ -163,5 +163,5 @@
     bool status = false;
 
-    addWhereStr(exp_tag);
+    addWhereStr(exp_id);
     // convert '-inst' to 'camera'
     if ((str = psMetadataLookupStr(&status, config->args, "-inst"))) {
Index: trunk/ippTools/src/pxcam.c
===================================================================
--- trunk/ippTools/src/pxcam.c	(revision 14018)
+++ trunk/ippTools/src/pxcam.c	(revision 14023)
@@ -66,5 +66,5 @@
     PS_ASSERT_PTR_NON_NULL(config, false);
 
-    // load the SQL to enqueue our exp_tags from disk once
+    // load the SQL to enqueue our exp_ids from disk once
     static psString query = NULL;
     if (!query) {
Index: trunk/ippTools/src/pxchip.c
===================================================================
--- trunk/ippTools/src/pxchip.c	(revision 14018)
+++ trunk/ippTools/src/pxchip.c	(revision 14023)
@@ -57,5 +57,5 @@
 
 bool pxchipQueueByExpTag(pxConfig *config,
-                         psString exp_tag,
+                         psString exp_id,
                          psString workdir,
                          psString label,
@@ -96,5 +96,5 @@
 #endif
 
-    // populate the chipInputImfile table from rawImfile based on exp_tag,
+    // populate the chipInputImfile table from rawImfile based on exp_id,
     // where the coresponding newExp.state entry is set to stop
     psString query = pxDataGetCached("chiptool_queuerawimfile.sql");
@@ -104,6 +104,6 @@
     }
 
-    // queue the imfiles for the exp_tag
-    if (!p_psDBRunQuery(config->dbh, query, exp_tag)) {
+    // queue the imfiles for the exp_id
+    if (!p_psDBRunQuery(config->dbh, query, exp_id)) {
         psError(PS_ERR_UNKNOWN, false, "database error");
         return false;
Index: trunk/ippTools/src/pxchip.h
===================================================================
--- trunk/ippTools/src/pxchip.h	(revision 14018)
+++ trunk/ippTools/src/pxchip.h	(revision 14023)
@@ -28,5 +28,5 @@
 
 bool pxchipQueueByExpTag(pxConfig *config,
-                         psString exp_tag,
+                         psString exp_id,
                          psString workdir,
                          psString label,
Index: trunk/ippTools/src/pxinject.c
===================================================================
--- trunk/ippTools/src/pxinject.c	(revision 14018)
+++ trunk/ippTools/src/pxinject.c	(revision 14023)
@@ -80,29 +80,29 @@
 
     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");
-        return false;
-    }
-    psString camera = psMetadataLookupStr(&status, config->args, "-inst");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -inst");
-        return false;
-    }
-    if (!camera) {
-        psError(PS_ERR_UNKNOWN, true, "-inst is required");
-        return false;
-    }
-    psString telescope = psMetadataLookupStr(&status, config->args, "-telescope");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -telescope");
-        return false;
-    }
-    if (!telescope) {
-        psError(PS_ERR_UNKNOWN, true, "-telescope is required");
+    psString tmp_exp_name = psMetadataLookupStr(&status, config->args, "-tmp_exp_name");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -tmp_exp_name");
+        return false;
+    }
+    if (!tmp_exp_name) {
+        psError(PS_ERR_UNKNOWN, true, "-tmp_exp_name is required");
+        return false;
+    }
+    psString tmp_camera = psMetadataLookupStr(&status, config->args, "-tmp_inst");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -tmp_inst");
+        return false;
+    }
+    if (!tmp_camera) {
+        psError(PS_ERR_UNKNOWN, true, "-tmp_inst is required");
+        return false;
+    }
+    psString tmp_telescope = psMetadataLookupStr(&status, config->args, "-tmp_telescope");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -tmp_telescope");
+        return false;
+    }
+    if (!tmp_telescope) {
+        psError(PS_ERR_UNKNOWN, true, "-tmp_telescope is required");
         return false;
     }
@@ -127,16 +127,10 @@
     }
 
-    psString exp_tag = pxGenExpTag(config, exp_id);
-    if (!exp_tag) {
-        psError(PS_ERR_UNKNOWN, false, "database error");
-        return false;
-    }
-
     if (!newExpInsert(config->dbh,
-                exp_tag,
-                exp_id,
+                0x0, // exp_id
+                tmp_exp_name,
                 "reg", // state
-                camera,
-                telescope,
+                tmp_camera,
+                tmp_telescope,
                 imfiles,
                 workdir,
@@ -145,16 +139,17 @@
         ) {
         psError(PS_ERR_UNKNOWN, false, "database error");
-        psFree(exp_tag);
-        return false;
-    }
+        return false;
+    }
+
+    psS64 lastInsertID = psDBLastInsertID(config->dbh);
+    psString exp_id = psDBIntToString(lastInsertID);
 
     psMetadata *md = psMetadataAlloc();
-    if (!psMetadataAddStr(md, PS_LIST_TAIL, "exp_tag", 0, NULL, exp_tag)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
+    if (!psMetadataAddStr(md, PS_LIST_TAIL, "exp_id", 0, NULL, exp_id)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
         psFree(md);
-        psFree(exp_tag);
-        psFree(md);
-    }
-    psFree(exp_tag);
+        psFree(exp_id);
+    }
+    psFree(exp_id);
 
     bool simple = false;
@@ -186,11 +181,11 @@
 
     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");
+    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");
         return false;
     }
@@ -206,11 +201,11 @@
     }
 #endif
-    psString class_id = psMetadataLookupStr(&status, config->args, "-class_id");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -class_id");
-        return false;
-    }
-    if (!class_id) {
-        psError(PS_ERR_UNKNOWN, true, "-class_id is required");
+    psString tmp_class_id = psMetadataLookupStr(&status, config->args, "-tmp_class_id");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -tmp_class_id");
+        return false;
+    }
+    if (!tmp_class_id) {
+        psError(PS_ERR_UNKNOWN, true, "-tmp_class_id is required");
         return false;
     }
@@ -226,5 +221,5 @@
 
     // insert with error flag state set to 0 (no errors)
-    if (!newImfileInsert(config->dbh, exp_tag, class_id, uri)) {
+    if (!newImfileInsert(config->dbh, (psS64)atoll(exp_id), tmp_class_id, uri)) {
         psError(PS_ERR_UNKNOWN, false, "database error");
         return false;
@@ -240,11 +235,11 @@
 
     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");
+    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");
         return false;
     }
@@ -262,5 +257,5 @@
     if (state) {
         // set detRun.state to state
-        return pxnewExpSetState(config, exp_tag, state);
+        return pxnewExpSetState(config, exp_id, state);
     }
 
Index: trunk/ippTools/src/pxinjectConfig.c
===================================================================
--- trunk/ippTools/src/pxinjectConfig.c	(revision 14018)
+++ trunk/ippTools/src/pxinjectConfig.c	(revision 14023)
@@ -45,9 +45,9 @@
     // -newExp
     psMetadata *newExpArgs = psMetadataAlloc();
-    psMetadataAddStr(newExpArgs, PS_LIST_TAIL, "-exp_id",  0,
-            "define the exp_id (required)", NULL);
-    psMetadataAddStr(newExpArgs, PS_LIST_TAIL, "-inst",  0,
+    psMetadataAddStr(newExpArgs, PS_LIST_TAIL, "-tmp_exp_name",  0,
+            "define the exp_name (required)", NULL);
+    psMetadataAddStr(newExpArgs, PS_LIST_TAIL, "-tmp_inst",  0,
             "define the camera name (required)", NULL);
-    psMetadataAddStr(newExpArgs, PS_LIST_TAIL, "-telescope",  0,
+    psMetadataAddStr(newExpArgs, PS_LIST_TAIL, "-tmp_telescope",  0,
             "define the telescope name (required)", NULL);
     psMetadataAddS32(newExpArgs, PS_LIST_TAIL, "-imfiles",  0,
@@ -60,11 +60,11 @@
     // -newImfile
     psMetadata *newImfileArgs = psMetadataAlloc();
-    psMetadataAddStr(newImfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
-            "define the exp_tag (required)", NULL);
+    psMetadataAddStr(newImfileArgs, PS_LIST_TAIL, "-exp_id",  0,
+            "define the exp_id (required)", NULL);
 #if 0
     psMetadataAddStr(newImfileArgs, PS_LIST_TAIL, "-class",  0,
             "define the class (required)", NULL);
 #endif
-    psMetadataAddStr(newImfileArgs, PS_LIST_TAIL, "-class_id",  0,
+    psMetadataAddStr(newImfileArgs, PS_LIST_TAIL, "-tmp_class_id",  0,
             "define the class ID (required)", NULL);
     psMetadataAddStr(newImfileArgs, PS_LIST_TAIL, "-uri",  0,
@@ -73,6 +73,6 @@
     // -updatenewExp
     psMetadata *updatenewExpArgs = psMetadataAlloc();
-    psMetadataAddStr(updatenewExpArgs, PS_LIST_TAIL, "-exp_tag",  0,
-            "define the exp_tag (required)", NULL);
+    psMetadataAddStr(updatenewExpArgs, PS_LIST_TAIL, "-exp_id",  0,
+            "define the exp_id (required)", NULL);
     psMetadataAddStr(updatenewExpArgs, PS_LIST_TAIL, "-state", 0,
             "set state (required)", NULL);
@@ -127,5 +127,5 @@
     }
     addWhereStr(det_type);
-    addWhereStr(exp_tag);
+    addWhereStr(exp_id);
     addWhereStr(class_id);
     // convert '-inst' to 'camera'
Index: trunk/ippTools/src/pxregister.c
===================================================================
--- trunk/ippTools/src/pxregister.c	(revision 14018)
+++ trunk/ippTools/src/pxregister.c	(revision 14023)
@@ -29,7 +29,7 @@
 #include "pxregister.h"
 
-bool pxnewExpSetState(pxConfig *config, const char *exp_tag, const char *state)
+bool pxnewExpSetState(pxConfig *config, const char *exp_id, const char *state)
 {
-    PS_ASSERT_PTR_NON_NULL(exp_tag, false);
+    PS_ASSERT_PTR_NON_NULL(exp_id, false);
     PS_ASSERT_PTR_NON_NULL(state, false);
 
@@ -46,8 +46,8 @@
     }
 
-    char *query = "UPDATE newExp SET state = '%s' WHERE exp_tag = '%s'";
-    if (!p_psDBRunQuery(config->dbh, query, state, exp_tag)) {
+    char *query = "UPDATE newExp SET state = '%s' WHERE exp_id = '%s'";
+    if (!p_psDBRunQuery(config->dbh, query, state, exp_id)) {
         psError(PS_ERR_UNKNOWN, false,
-                "failed to change state for exp_tag %s", exp_tag);
+                "failed to change state for exp_id %s", exp_id);
         return false;
     }
Index: trunk/ippTools/src/pxregister.h
===================================================================
--- trunk/ippTools/src/pxregister.h	(revision 14018)
+++ trunk/ippTools/src/pxregister.h	(revision 14023)
@@ -25,5 +25,5 @@
 #include "pxtools.h"
 
-bool pxnewExpSetState(pxConfig *config, const char *exp_tag, const char *state);
+bool pxnewExpSetState(pxConfig *config, const char *exp_id, const char *state);
 
 #endif // PXREGISTER_H
Index: trunk/ippTools/src/pxtables.c
===================================================================
--- trunk/ippTools/src/pxtables.c	(revision 14018)
+++ trunk/ippTools/src/pxtables.c	(revision 14023)
@@ -43,4 +43,5 @@
 
     bool            status = true;
+#if 0
     CREATE_TABLE(expTagCounterCreateTable);
     // the counter must be initialized to 0
@@ -49,4 +50,5 @@
         status = false; 
     }
+#endif
     CREATE_TABLE(summitExpCreateTable);
     CREATE_TABLE(summitImfileCreateTable);
@@ -129,5 +131,5 @@
     }
 
-    DROP_TABLE(expTagCounterDropTable);
+//    DROP_TABLE(expTagCounterDropTable);
     DROP_TABLE(summitExpDropTable);
     DROP_TABLE(summitImfileDropTable);
Index: trunk/ippTools/src/pxtag.c
===================================================================
--- trunk/ippTools/src/pxtag.c	(revision 14018)
+++ trunk/ippTools/src/pxtag.c	(revision 14023)
@@ -27,5 +27,5 @@
 #include "pxtag.h"
 
-psString pxGenExpTag(pxConfig *config, const char *exp_id)
+psString pxGenExpTag(pxConfig *config, const char *exp_name)
 {
     PS_ASSERT_PTR_NON_NULL(config, NULL);
@@ -95,8 +95,8 @@
         return NULL;
     }
-    psString exp_tag = NULL;
-    psStringAppend(&exp_tag, "%s.%" PRIu64, exp_id, counter);
+    psString exp_id = NULL;
+    psStringAppend(&exp_id, "%s.%" PRIu64, exp_name, counter);
     psFree(output);
 
-    return exp_tag;
+    return exp_id;
 }
Index: trunk/ippTools/src/pxtag.h
===================================================================
--- trunk/ippTools/src/pxtag.h	(revision 14018)
+++ trunk/ippTools/src/pxtag.h	(revision 14023)
@@ -25,5 +25,5 @@
 #include "pxconfig.h"
 
-psString pxGenExpTag(pxConfig *config, const char *exp_id);
+psString pxGenExpTag(pxConfig *config, const char *exp_name);
 
 #endif // PXTAG_H
Index: trunk/ippTools/src/pzgetexp.c
===================================================================
--- trunk/ippTools/src/pzgetexp.c	(revision 14018)
+++ trunk/ippTools/src/pzgetexp.c	(revision 14023)
@@ -68,5 +68,5 @@
 {
     PS_ASSERT_PTR_NON_NULL(config, NULL);
-    // find last fileset/exp_id (if we have one)
+    // find last fileset/exp_name (if we have one)
     bool haveLastFileSet = false;
     psString lastFileSet = NULL;
@@ -90,5 +90,5 @@
             haveLastFileSet = true;
             bool status = false;
-            lastFileSet = psStringCopy(psMetadataLookupStr(&status, output->data[0], "exp_id"));
+            lastFileSet = psStringCopy(psMetadataLookupStr(&status, output->data[0], "exp_name"));
             psFree(output);
         }
@@ -142,5 +142,5 @@
     {
         char *query = "CREATE TEMPORARY TABLE incoming" 
-            " (exp_id VARCHAR(64), camera VARCHAR(64), telescope VARCHAR(64), dateobs DATETIME, exp_type VARCHAR(64), uri VARCHAR(255), PRIMARY KEY(exp_id, camera, telescope))"
+            " (exp_name VARCHAR(64), camera VARCHAR(64), telescope VARCHAR(64), dateobs DATETIME, exp_type VARCHAR(64), uri VARCHAR(255), PRIMARY KEY(exp_name, camera, telescope))"
            " ENGINE=MEMORY";
         if (!p_psDBRunQuery(config->dbh, query)) {
@@ -156,5 +156,5 @@
 
     {
-        char *query = "INSERT INTO incoming (exp_id, camera, telescope, dateobs, exp_type, uri) VALUES (?, ?, ?, ?, ?, ?)";
+        char *query = "INSERT INTO incoming (exp_name, camera, telescope, dateobs, exp_type, uri) VALUES (?, ?, ?, ?, ?, ?)";
 
         long inserted = p_psDBRunQueryPrepared(config->dbh, newSummitExps, query);
@@ -188,12 +188,12 @@
             "INSERT INTO pzPendingExp" 
             "   SElECT"
-            "       incoming.exp_id,"
+            "       incoming.exp_name,"
             "       incoming.camera,"
             "       incoming.telescope"
             "   FROM incoming"
             "   LEFT JOIN summitExp"
-            "       USING(exp_id, camera, telescope)"
+            "       USING(exp_name, camera, telescope)"
             "   WHERE"
-            "       summitExp.exp_id is NULL"
+            "       summitExp.exp_name is NULL"
             "       AND summitExp.camera is NULL"
             "       AND summitExp.telescope is NULL";
@@ -218,7 +218,7 @@
             "   FROM incoming"
             "   LEFT JOIN summitExp"
-            "       USING(exp_id, camera, telescope)"
+            "       USING(exp_name, camera, telescope)"
             "   WHERE"
-            "       summitExp.exp_id is NULL"
+            "       summitExp.exp_name is NULL"
             "       AND summitExp.camera is NULL"
             "       AND summitExp.telescope is NULL";
@@ -296,5 +296,5 @@
         psListIterator *tokenCursor = psListIteratorAlloc(tokens, 0, false);
         char *uri       = psListGetAndIncrement(tokenCursor);
-        char *exp_id    = psListGetAndIncrement(tokenCursor); // fileset
+        char *exp_name    = psListGetAndIncrement(tokenCursor); // fileset
         char *dateobsStr= psListGetAndIncrement(tokenCursor); // datetime
         char *exp_type  = psListGetAndIncrement(tokenCursor); // type
@@ -302,6 +302,6 @@
         // create a new metadata to represent this line and it's values
         psMetadata *md = psMetadataAlloc();
-        if (!psMetadataAddStr(md, PS_LIST_TAIL, "exp_id", 0, NULL, exp_id)) {
-            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
+        if (!psMetadataAddStr(md, PS_LIST_TAIL, "exp_name", 0, NULL, exp_name)) {
+            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_name");
             psFree(md);
             psFree(tokenCursor);
Index: trunk/ippTools/src/pzgetimfiles.c
===================================================================
--- trunk/ippTools/src/pzgetimfiles.c	(revision 14018)
+++ trunk/ippTools/src/pzgetimfiles.c	(revision 14023)
@@ -161,5 +161,5 @@
             "UPDATE summitExp"
             " SET imfiles = %d"
-            " WHERE exp_id = '%s'"
+            " WHERE exp_name = '%s'"
             " AND camera = '%s'"
             " AND telescope = '%s'";
@@ -178,5 +178,5 @@
                 "DELETE FROM pzPendingExp"
                 " WHERE"
-                "   exp_id = '%s'"
+                "   exp_name = '%s'"
                 "   AND camera = '%s'"
                 "   AND telescope = '%s'";
@@ -220,5 +220,5 @@
     {
         char *query = 
-            "CREATE TEMPORARY TABLE incoming (exp_id VARCHAR(64), camera VARCHAR(64), telescope VARCHAR(64), file_id VARCHAR(64), bytes INT, md5sum VARCHAR(32), class VARCHAR(64), class_id VARCHAR(64), uri VARCHAR(255), PRIMARY KEY(exp_id, camera, telescope, class, class_id)) ENGINE=MEMORY";
+            "CREATE TEMPORARY TABLE incoming (exp_name VARCHAR(64), camera VARCHAR(64), telescope VARCHAR(64), file_id VARCHAR(64), bytes INT, md5sum VARCHAR(32), class VARCHAR(64), class_id VARCHAR(64), uri VARCHAR(255), PRIMARY KEY(exp_name, camera, telescope, class, class_id)) ENGINE=MEMORY";
 
         if (!p_psDBRunQuery(config->dbh, query)) {
@@ -235,5 +235,5 @@
     // load the imfiles (files) into the temp table
     {
-        char *query = "INSERT INTO incoming (exp_id, camera, telescope, file_id, bytes, md5sum, class, class_id, uri) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
+        char *query = "INSERT INTO incoming (exp_name, camera, telescope, file_id, bytes, md5sum, class, class_id, uri) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
 
         long inserted = p_psDBRunQueryPrepared(config->dbh, newImfiles, query);
@@ -270,17 +270,17 @@
             "INSERT INTO pzPendingImfile" 
             "   SElECT"
-            "       incoming.exp_id,"
+            "       incoming.exp_name,"
             "       incoming.camera,"
             "       incoming.telescope,"
             "       incoming.class,"
             "       incoming.class_id,"
-            "       NULL" // exp_tag, will be assigned later
+            "       NULL" // exp_id, will be assigned later
             "   FROM incoming"
             "   JOIN pzPendingExp"
-            "       USING(exp_id, camera, telescope)"
+            "       USING(exp_name, camera, telescope)"
             "   LEFT JOIN summitImfile"
-            "       USING(exp_id, camera, telescope, class, class_id)"
+            "       USING(exp_name, camera, telescope, class, class_id)"
             "   WHERE"
-            "       summitImfile.exp_id is NULL"
+            "       summitImfile.exp_name is NULL"
             "       AND summitImfile.camera is NULL"
             "       AND summitImfile.telescope is NULL"
@@ -303,5 +303,5 @@
             "INSERT INTO summitImfile" 
             "   SElECT"
-            "       incoming.exp_id,"
+            "       incoming.exp_name,"
             "       incoming.camera,"
             "       incoming.telescope,"
@@ -314,7 +314,7 @@
             "   FROM incoming"
             "   LEFT JOIN summitImfile"
-            "       USING(exp_id, camera, telescope, class, class_id)"
+            "       USING(exp_name, camera, telescope, class, class_id)"
             "   WHERE"
-            "       summitImfile.exp_id is NULL"
+            "       summitImfile.exp_name is NULL"
             "       AND summitImfile.camera is NULL"
             "       AND summitImfile.telescope is NULL"
@@ -338,10 +338,10 @@
             " SET imfiles = (SELECT COUNT(*) FROM summitImfile"
             "   WHERE"
-            "       exp_id = '%s'"
+            "       exp_name = '%s'"
             "       AND camera = '%s'"
             "       AND telescope = '%s'"
             ")" 
             " WHERE"
-            "   exp_id = '%s'"
+            "   exp_name = '%s'"
             "   AND camera = '%s'"
             "   AND telescope = '%s'";
@@ -367,8 +367,8 @@
     }
 
-    // copy the summitExp row into newExp in order to create a new exp_tag
-    {
-        psString exp_tag = pxGenExpTag(config, filesetid);
-        if (!exp_tag) {
+    // copy the summitExp row into newExp in order to create a new exp_id
+    {
+        psString exp_id = pxGenExpTag(config, filesetid);
+        if (!exp_id) {
             // rollback
             if (!psDBRollback(config->dbh)) {
@@ -382,6 +382,6 @@
             "INSERT INTO newExp" 
             "   SElECT"
-            "       '%s'," // exp_tag
-            "       summitExp.exp_id,"
+            "       '%s'," // exp_id
+            "       summitExp.exp_name,"
             "       summitExp.camera,"
             "       summitExp.telescope,"
@@ -392,18 +392,18 @@
             "   FROM summitExp"
             "   WHERE"
-            "       summitExp.exp_id = '%s'"
+            "       summitExp.exp_name = '%s'"
             "       AND summitExp.camera = '%s'"
             "       AND summitExp.telescope = '%s'";
 
-        if (!p_psDBRunQuery(config->dbh, query, exp_tag, filesetid, camera, telescope)) {
-            // rollback
-            if (!psDBRollback(config->dbh)) {
-                psError(PS_ERR_UNKNOWN, false, "database error");
-            }
-            psError(PS_ERR_UNKNOWN, false, "database error");
-            psFree(exp_tag);
-            return false;
-        }
-        psFree(exp_tag);
+        if (!p_psDBRunQuery(config->dbh, query, exp_id, filesetid, camera, telescope)) {
+            // rollback
+            if (!psDBRollback(config->dbh)) {
+                psError(PS_ERR_UNKNOWN, false, "database error");
+            }
+            psError(PS_ERR_UNKNOWN, false, "database error");
+            psFree(exp_id);
+            return false;
+        }
+        psFree(exp_id);
 
         // sanity check: we should have inserted only one row
@@ -419,15 +419,15 @@
     }
  
-    // set the exp_tag for the imfiles (files) in the exposure (fileset) that
+    // set the exp_id for the imfiles (files) in the exposure (fileset) that
     // we are investigating
     {
         char *query = 
             "UPDATE pzPendingImfile"
-            " SET exp_tag = (SELECT exp_tag from newExp"
-            "                WHERE exp_id = '%s'"
+            " SET exp_id = (SELECT exp_id from newExp"
+            "                WHERE exp_name = '%s'"
             "                AND camera = '%s'"
             "                AND telescope = '%s')"
             " WHERE"
-            "   exp_id = '%s'"
+            "   exp_name = '%s'"
             "   AND camera = '%s'"
             "   AND telescope = '%s'";
@@ -450,5 +450,5 @@
             "   FROM pzPendingExp"
             "   WHERE"
-            "       pzPendingExp.exp_id = '%s'"
+            "       pzPendingExp.exp_name = '%s'"
             "       AND pzPendingExp.camera = '%s'"
             "       AND pzPendingExp.telescope = '%s'";
@@ -479,5 +479,5 @@
             "DELETE FROM pzPendingExp"
             " WHERE"
-            "   exp_id = '%s'"
+            "   exp_name = '%s'"
             "   AND camera = '%s'"
             "   AND telescope = '%s'";
@@ -524,10 +524,10 @@
     // any work
     bool status = false;
-    psString exp_id = psMetadataLookupStr(&status, config->args, "-filesetid");
+    psString exp_name = psMetadataLookupStr(&status, config->args, "-filesetid");
     if (!status) {
         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for '-filesetid'");
         return NULL;
     }
-    if (!exp_id) {
+    if (!exp_name) {
         psError(PS_ERR_UNKNOWN, true, "-filesetid is required");
         return NULL;
@@ -596,6 +596,6 @@
         // create a new metadata to represent this line and it's values
         psMetadata *md = psMetadataAlloc();
-        if (!psMetadataAddStr(md, PS_LIST_TAIL, "exp_id", 0, NULL, exp_id)) {
-            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
+        if (!psMetadataAddStr(md, PS_LIST_TAIL, "exp_name", 0, NULL, exp_name)) {
+            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_name");
             psFree(md);
             psFree(tokenCursor);
Index: trunk/ippTools/src/pztool.c
===================================================================
--- trunk/ippTools/src/pztool.c	(revision 14018)
+++ trunk/ippTools/src/pztool.c	(revision 14023)
@@ -140,5 +140,5 @@
             " FROM pzPendingExp"
             " JOIN summitExp"
-            "   USING(exp_id, camera, telescope)"
+            "   USING(exp_name, camera, telescope)"
         );
 
@@ -197,8 +197,8 @@
             "SELECT"
             "   summitImfile.*,"
-            "   pzPendingImfile.exp_tag"
+            "   pzPendingImfile.exp_id"
             " FROM pzPendingImfile"
             " JOIN summitImfile"
-            "   USING(exp_id, camera, telescope, class, class_id)"
+            "   USING(exp_name, camera, telescope, class, class_id)"
         );
 
@@ -255,11 +255,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_name = psMetadataLookupStr(&status, config->args, "-exp_name");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_name");
+        return false;
+    }
+    if (!exp_name) {
+        psError(PS_ERR_UNKNOWN, true, "-exp_name is required");
         return false;
     }
@@ -315,5 +315,5 @@
     }
 
-    // need to know exp_id, camera, telescope, class, class_id (to find the
+    // need to know exp_name, camera, telescope, class, class_id (to find the
     // pzPendingImfile entry and the URI for the newImfile entry.
 
@@ -329,5 +329,5 @@
             "INSERT INTO newImfile"
             "   SElECT"
-            "       pzPendingImfile.exp_tag,"
+            "       pzPendingImfile.exp_id,"
             "       pzPendingImfile.class,"
             "       pzPendingImfile.class_id,"
@@ -336,5 +336,5 @@
             "   FROM pzPendingImfile"
             "   WHERE"
-            "       pzPendingImfile.exp_id = '%s'"
+            "       pzPendingImfile.exp_name = '%s'"
             "       AND pzPendingImfile.camera = '%s'"
             "       AND pzPendingImfile.telescope = '%s'"
@@ -342,5 +342,5 @@
             "       AND pzPendingImfile.class_id = '%s'";
 
-        if (!p_psDBRunQuery(config->dbh, query, uri, exp_id, camera, telescope, class, class_id)) {
+        if (!p_psDBRunQuery(config->dbh, query, uri, exp_name, camera, telescope, class, class_id)) {
             // rollback
             if (!psDBRollback(config->dbh)) {
@@ -372,5 +372,5 @@
             "   FROM pzPendingImfile"
             "   WHERE"
-            "       pzPendingImfile.exp_id = '%s'"
+            "       pzPendingImfile.exp_name = '%s'"
             "       AND pzPendingImfile.camera = '%s'"
             "       AND pzPendingImfile.telescope = '%s'"
@@ -378,5 +378,5 @@
             "       AND pzPendingImfile.class_id = '%s'";
 
-        if (!p_psDBRunQuery(config->dbh, query, uri, exp_id, camera, telescope, class, class_id)) {
+        if (!p_psDBRunQuery(config->dbh, query, uri, exp_name, camera, telescope, class, class_id)) {
             // rollback
             if (!psDBRollback(config->dbh)) {
@@ -404,5 +404,5 @@
             "DELETE FROM pzPendingImfile"
             "   WHERE"
-            "       pzPendingImfile.exp_id = '%s'"
+            "       pzPendingImfile.exp_name = '%s'"
             "       AND pzPendingImfile.camera = '%s'"
             "       AND pzPendingImfile.telescope = '%s'"
@@ -410,5 +410,5 @@
             "       AND pzPendingImfile.class_id = '%s'";
 
-        if (!p_psDBRunQuery(config->dbh, query, exp_id, camera, telescope, class, class_id)) {
+        if (!p_psDBRunQuery(config->dbh, query, exp_name, camera, telescope, class, class_id)) {
             // rollback
             if (!psDBRollback(config->dbh)) {
Index: trunk/ippTools/src/pztoolConfig.c
===================================================================
--- trunk/ippTools/src/pztoolConfig.c	(revision 14018)
+++ trunk/ippTools/src/pztoolConfig.c	(revision 14023)
@@ -45,5 +45,5 @@
     // -seen
     psMetadata *seenArgs = psMetadataAlloc();
-    psMetadataAddStr(seenArgs, PS_LIST_TAIL, "-exp_tag", 0,
+    psMetadataAddStr(seenArgs, PS_LIST_TAIL, "-exp_id", 0,
             "define exposure ID", NULL); 
     psMetadataAddStr(seenArgs, PS_LIST_TAIL, "-inst", 0,
@@ -58,5 +58,5 @@
     // -pendingexp
     psMetadata *pendingexpArgs = psMetadataAlloc();
-    psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-exp_tag", 0,
+    psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-exp_id", 0,
             "define exposure ID", NULL); 
     psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-inst", 0,
@@ -71,5 +71,5 @@
     // -pendingimfile
     psMetadata *pendingimfileArgs = psMetadataAlloc();
-    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-exp_tag", 0,
+    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-exp_id", 0,
             "define exposure ID", NULL); 
     psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-inst", 0,
@@ -84,5 +84,5 @@
     // -copydone
     psMetadata *copydoneArgs = psMetadataAlloc();
-    psMetadataAddStr(copydoneArgs, PS_LIST_TAIL, "-exp_id", 0,
+    psMetadataAddStr(copydoneArgs, PS_LIST_TAIL, "-exp_name", 0,
             "define exposure ID", NULL); 
     psMetadataAddStr(copydoneArgs, PS_LIST_TAIL, "-inst", 0,
@@ -173,5 +173,5 @@
     config->where = psMetadataAlloc();
 
-    addWhereStr(exp_tag); 
+    addWhereStr(exp_id); 
     addWhereStr(telescope); 
     // convert '-inst' to 'camera'
Index: trunk/ippTools/src/regtool.c
===================================================================
--- trunk/ippTools/src/regtool.c	(revision 14018)
+++ trunk/ippTools/src/regtool.c	(revision 14023)
@@ -111,7 +111,7 @@
 
     // select newImfiles that:
-    // exp_tag is in newExp
-    // don't have their exp_tag in rawExp 
-    // XXX having the same exp_tag in newExp and raw*Exp is probably an error
+    // exp_id is in newExp
+    // don't have their exp_id in rawExp 
+    // XXX having the same exp_id in newExp and raw*Exp is probably an error
     // that should be checked for
 
@@ -181,5 +181,5 @@
     PS_ASSERT_PTR_NON_NULL(config, false);
 
-    psString query = pxDataGet("regtool_find_unprocessed_imfile.sql");
+    psString query = pxDataGet("regtool_pendingimfile.sql");
     if (!query) {
         psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
@@ -188,16 +188,16 @@
 
     {
-        // build a query to search by exp_tag, class, class_id
+        // build a query to search by exp_id, class, class_id
         psMetadata *where = psMetadataAlloc();
         bool status = false;
-        psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
+        psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
         if (!status) {
-            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
+            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
             psFree(query);
             return false;
         }
-        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");
+        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");
                 psFree(where);
                 psFree(query);
@@ -206,13 +206,13 @@
         }
 
-        psString class_id = psMetadataLookupStr(&status, config->args, "-class_id");
+        psString tmp_class_id = psMetadataLookupStr(&status, config->args, "-tmp_class_id");
         if (!status) {
-            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -class_id");
+            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -tmp_class_id");
             psFree(query);
             return false;
         }
-        if (class_id) {
-            if (!psMetadataAddStr(where, PS_LIST_TAIL, "class_id", 0, "==", class_id)) {
-                psError(PS_ERR_UNKNOWN, false, "failed to add item class_id");
+        if (tmp_class_id) {
+            if (!psMetadataAddStr(where, PS_LIST_TAIL, "tmp_class_id", 0, "==", tmp_class_id)) {
+                psError(PS_ERR_UNKNOWN, false, "failed to add item tmp_class_id");
                 psFree(where);
                 psFree(query);
@@ -511,17 +511,17 @@
     PS_ASSERT_PTR_NON_NULL(config, false);
 
-    // make sure that the exp_tag(s) are ready to be updated based on:
-    // exp_tag is not in rawExp
-    // exp_tag is not in newImfile
+    // make sure that the exp_id(s) are ready to be updated based on:
+    // exp_id is not in rawExp
+    // exp_id is not in newImfile
     // that the correct count of imfiles is in rawImfile
    
     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");
+    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");
         return false;
     }
@@ -539,5 +539,5 @@
     }
 
-    if (!p_psDBRunQuery(config->dbh, query, exp_tag)) {
+    if (!p_psDBRunQuery(config->dbh, query, exp_id)) {
         psError(PS_ERR_UNKNOWN, false, "database error");
         psFree(query);
@@ -608,10 +608,10 @@
         if (detrend) {
             // set the state for the newExp to stop 
-            if (!pxnewExpSetState(config, exp_tag, "stop")) {
+            if (!pxnewExpSetState(config, exp_id, "stop")) {
                 // rollback
                 if (!psDBRollback(config->dbh)) {
                     psError(PS_ERR_UNKNOWN, false, "database error");
                 }
-                psError(PS_ERR_UNKNOWN, false, "failed to change newExp.state for exp_tag: %s", exp_tag);
+                psError(PS_ERR_UNKNOWN, false, "failed to change newExp.state for exp_id: %s", exp_id);
                 psFree(output);
                 return false;
@@ -622,10 +622,10 @@
 
         // set the state for the newExp to stop
-        if (!pxnewExpSetState(config, exp_tag, "stop")) {
+        if (!pxnewExpSetState(config, exp_id, "stop")) {
             // rollback
             if (!psDBRollback(config->dbh)) {
                 psError(PS_ERR_UNKNOWN, false, "database error");
             }
-            psError(PS_ERR_UNKNOWN, false, "failed to change newExp.state for exp_tag: %s", exp_tag);
+            psError(PS_ERR_UNKNOWN, false, "failed to change newExp.state for exp_id: %s", exp_id);
             psFree(output);
             return false;
@@ -634,5 +634,5 @@
         // 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_tag, NULL, NULL, NULL, NULL, NULL)) {
+        if (!pxchipQueueByExpTag(config, exp_id, NULL, NULL, NULL, NULL, NULL)) {
             // rollback
             if (!psDBRollback(config->dbh)) {
@@ -776,5 +776,5 @@
 {
     return guidePendingExpRowAlloc(
-        newExp->exp_tag,
+        newExp->exp_id,
         newExp->camera,
         newExp->telescope,
@@ -810,5 +810,5 @@
     chipPendingExpRow *chipExp = chipPendingExpRowAlloc(
             0,              // chip ID, assigned by db
-            exp->exp_tag,
+            exp->exp_id,
             0xdeadbeef,     // guide version
             label,
@@ -839,4 +839,55 @@
 
     bool status = false;
+    // required
+    psString exp_name = psMetadataLookupStr(&status, config->args, "-exp_name");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_name");
+        return false;
+    }
+    if (!exp_name) {
+        psError(PS_ERR_UNKNOWN, true, "-exp_name is required");
+        return false;
+    }
+
+    psString camera = psMetadataLookupStr(&status, config->args, "-inst");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -inst");
+        return false;
+    }
+    if (!camera) {
+        psError(PS_ERR_UNKNOWN, true, "-inst is required");
+        return false;
+    }
+
+    psString telescope = psMetadataLookupStr(&status, config->args, "-telescope");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -telescope");
+        return false;
+    }
+    if (!telescope) {
+        psError(PS_ERR_UNKNOWN, true, "-telescope is required");
+        return false;
+    }
+
+    psS32 imfiles = psMetadataLookupS32(&status, config->args, "-imfiles");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -imfiles");
+        return false;
+    }
+    if (!imfiles) {
+        psError(PS_ERR_UNKNOWN, true, "-imfiles is required");
+        return 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;
+    }
+
     // optional
     psString exp_type = psMetadataLookupStr(&status, config->args, "-exp_type");
@@ -989,11 +1040,12 @@
 
     rawExpRow *raw = rawExpRowAlloc(
-        exp->exp_tag,
         exp->exp_id,
-        exp->camera,
-        exp->telescope,
+        exp_name,
+        camera,
+        telescope,
         dateobs,
+        exp_tag,
         exp_type,
-        exp->imfiles,
+        imfiles,
         filelevel,
         exp->workdir,
@@ -1011,9 +1063,9 @@
         ccd_temp,
         posang,
-	user_1,
-	user_2,
-	user_3,
-	user_4,
-	user_5,
+        user_1,
+        user_2,
+        user_3,
+        user_4,
+        user_5,
         object,
         0.0,
@@ -1035,4 +1087,55 @@
 
     bool status = false;
+    // required
+    psString exp_name = psMetadataLookupStr(&status, config->args, "-exp_name");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_name");
+        return false;
+    }
+    if (!exp_name) {
+        psError(PS_ERR_UNKNOWN, true, "-exp_name is required");
+        return false;
+    }
+
+    psString camera = psMetadataLookupStr(&status, config->args, "-inst");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -inst");
+        return false;
+    }
+    if (!camera) {
+        psError(PS_ERR_UNKNOWN, true, "-inst is required");
+        return false;
+    }
+
+    psString telescope = psMetadataLookupStr(&status, config->args, "-telescope");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -telescope");
+        return false;
+    }
+    if (!telescope) {
+        psError(PS_ERR_UNKNOWN, true, "-telescope is required");
+        return false;
+    }
+
+    psString tmp_class_id = psMetadataLookupStr(&status, config->args, "-tmp_class_id");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -tmp_class_id");
+        return false;
+    }
+    if (!tmp_class_id) {
+        psError(PS_ERR_UNKNOWN, true, "-tmp_class_id is required");
+        return false;
+    }
+
+    psString class_id = psMetadataLookupStr(&status, config->args, "-class_id");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -class_id");
+        return false;
+    }
+    if (!class_id) {
+        psError(PS_ERR_UNKNOWN, true, "-class_id is required");
+        return false;
+    }
+
     // optional
     psString exp_type = psMetadataLookupStr(&status, config->args, "-exp_type");
@@ -1180,6 +1283,11 @@
 
     rawImfileRow *raw = rawImfileRowAlloc(
-        imfile->exp_tag,
-        imfile->class_id,
+        imfile->exp_id,
+        exp_name,
+        camera,
+        telescope,
+        dateobs,
+        tmp_class_id,
+        class_id,
         imfile->uri,
         exp_type,
@@ -1198,11 +1306,10 @@
         ccd_temp,
         posang,
-	user_1,
-	user_2,
-	user_3,
-	user_4,
-	user_5,
+        user_1,
+        user_2,
+        user_3,
+        user_4,
+        user_5,
         object,
-        dateobs,
         code
     );
Index: trunk/ippTools/src/regtoolConfig.c
===================================================================
--- trunk/ippTools/src/regtoolConfig.c	(revision 14018)
+++ trunk/ippTools/src/regtoolConfig.c	(revision 14023)
@@ -48,5 +48,5 @@
     // -pendingimfile
     psMetadata *pendingimfileArgs = psMetadataAlloc();
-    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
+    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-exp_id",  0,
         "search by exposure ID", NULL);
     psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-class",  0,
@@ -61,6 +61,14 @@
     // -addprocessedimfile
     psMetadata *addprocessedimfileArgs = psMetadataAlloc();
-    psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
+    psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-exp_id",  0,
         "define exposure ID (required)", NULL);
+    psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-exp_name",  0,
+        "define the exp_name (required)", NULL); 
+    psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-inst",  0,
+        "define the camera name (required)", NULL);
+    psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-telescope",  0,
+        "define the telescope name (required)", NULL);
+    psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-tmp_class_id",  0,
+        "define temp. class ID (required)", NULL);
     psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-class_id",  0,
         "define class ID (required)", NULL);
@@ -114,5 +122,5 @@
     // -processedimfile
     psMetadata *processedimfileArgs = psMetadataAlloc();
-    psMetadataAddStr(processedimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
+    psMetadataAddStr(processedimfileArgs, PS_LIST_TAIL, "-exp_id",  0,
         "search by exposure ID", NULL);
     psMetadataAddStr(processedimfileArgs, PS_LIST_TAIL, "-class_id",  0,
@@ -127,5 +135,5 @@
     // -updateprocessedimfile
     psMetadata *updateprocessedimfileArgs = psMetadataAlloc();
-    psMetadataAddStr(updateprocessedimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
+    psMetadataAddStr(updateprocessedimfileArgs, PS_LIST_TAIL, "-exp_id",  0,
         "search by exposure ID", NULL);
     psMetadataAddStr(updateprocessedimfileArgs, PS_LIST_TAIL, "-class_id",  0,
@@ -137,5 +145,5 @@
     // -pendingexp
     psMetadata *pendingexpArgs = psMetadataAlloc();
-    psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-exp_tag",  0,
+    psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-exp_id",  0,
         "search by exposure ID", NULL);
     psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-inst",  0,
@@ -154,8 +162,20 @@
     // -addprocessedexp
     psMetadata *addprocessedexpArgs = psMetadataAlloc();
+    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-exp_id",  0,
+        "exp_id to operate on (required)", NULL); 
+    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-exp_name",  0,
+        "define the exp_name (required)", NULL); 
+    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-inst",  0,
+        "define the camera name (required)", NULL);
+    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-telescope",  0,
+        "define the telescope name (required)", NULL);
     psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-exp_tag",  0,
-        "exp_tag to operate on (required)", NULL); 
+        "define the external exposure tag name (required)", NULL);
+    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-dateobs",  0,
+        "define observation time", NULL);
     psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-exp_type",  0,
         "define exposure type", NULL);
+    psMetadataAddS32(addprocessedexpArgs, PS_LIST_TAIL, "-imfiles",  0,
+        "define the number of imfiles in this exp (required)", 0);
     psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-filelevel",  0,
         "define the data partitioning level of this file", NULL);
@@ -200,6 +220,4 @@
     psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-object",  0,
         "define exposure object", NULL);
-    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-dateobs",  0,
-        "define observation time", NULL);
     psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-label",  0,
         "define label for phase 2 processing (non-detrend data only)", NULL);
@@ -217,5 +235,5 @@
     // -processedexp
     psMetadata *processedexpArgs = psMetadataAlloc();
-    psMetadataAddStr(processedexpArgs, PS_LIST_TAIL, "-exp_tag",  0,
+    psMetadataAddStr(processedexpArgs, PS_LIST_TAIL, "-exp_id",  0,
         "search by exposure ID", NULL);
     psMetadataAddU64(processedexpArgs, PS_LIST_TAIL, "-limit",  0,
@@ -228,5 +246,5 @@
     // -updatedprocessedexp
     psMetadata *updatedprocessedexpArgs = psMetadataAlloc();
-    psMetadataAddStr(updatedprocessedexpArgs, PS_LIST_TAIL, "-exp_tag",  0,
+    psMetadataAddStr(updatedprocessedexpArgs, PS_LIST_TAIL, "-exp_id",  0,
         "search by exposure ID", NULL);
     psMetadataAddS16(updatedprocessedexpArgs, PS_LIST_TAIL, "-code",  0,
@@ -274,5 +292,5 @@
     config->where = psMetadataAlloc();
 
-    addWhereStr(exp_tag);
+    addWhereStr(exp_id);
     // convert '-inst' to 'camera'
     {
Index: trunk/ippTools/src/stacktool.c
===================================================================
--- trunk/ippTools/src/stacktool.c	(revision 14018)
+++ trunk/ippTools/src/stacktool.c	(revision 14023)
@@ -124,5 +124,5 @@
     }
 
-    // we have to support multipe exp_tags
+    // we have to support multipe exp_ids
     psMetadataItem *warp_ids = psMetadataLookup(config->args, "-warp_id");
     if (!warp_ids) {
Index: trunk/ippTools/src/stacktoolConfig.c
===================================================================
--- trunk/ippTools/src/stacktoolConfig.c	(revision 14018)
+++ trunk/ippTools/src/stacktoolConfig.c	(revision 14023)
@@ -198,5 +198,5 @@
     addWhereStr(skycell_id);
     addWhereStr(tess_id);
-    addWhereStr(exp_tag);
+    addWhereStr(exp_id);
 
     if (config->where->list->n < 1) {
Index: trunk/ippTools/src/warptoolConfig.c
===================================================================
--- trunk/ippTools/src/warptoolConfig.c	(revision 14018)
+++ trunk/ippTools/src/warptoolConfig.c	(revision 14023)
@@ -165,5 +165,5 @@
     psMetadataAddStr(warpedArgs, PS_LIST_TAIL, "-tess_id",  0,
             "define tessellation ID", NULL);
-    psMetadataAddStr(warpedArgs, PS_LIST_TAIL, "-exp_tag", 0,
+    psMetadataAddStr(warpedArgs, PS_LIST_TAIL, "-exp_id", 0,
             "define exposure tag", NULL);
     psMetadataAddStr(warpedArgs, PS_LIST_TAIL, "-cam_id", 0,
@@ -254,5 +254,5 @@
     addWhereStr(skycell_id);
     addWhereStr(tess_id);
-    addWhereStr(exp_tag);
+    addWhereStr(exp_id);
 
     if (config->where->list->n < 1) {
