Index: /trunk/ippTools/src/dettool.c
===================================================================
--- /trunk/ippTools/src/dettool.c	(revision 7334)
+++ /trunk/ippTools/src/dettool.c	(revision 7335)
@@ -90,4 +90,9 @@
         case DETTOOL_MODE_NORMALIZEDFRAME:
             if (normalizedframeMode(config)) {
+                goto FAIL;
+            }
+            break;
+        case DETTOOL_MODE_ADDRESID:
+            if (addresidMode(config)) {
                 goto FAIL;
             }
@@ -1335,4 +1340,88 @@
     PS_ASSERT_PTR_NON_NULL(config, false);
 
+    // det_id, exp_id, class_id, stats, & recipe are required
+    bool status = false;
+    psString det_id = psMetadataLookupStr(&status, config->args, "-det_id");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -det_id");
+        return false;
+    }
+    if (!det_id) {
+        psError(PS_ERR_UNKNOWN, true, "-det_id is required");
+        return false;
+    }
+    psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
+        return false;
+    }
+    if (!exp_id) {
+        psError(PS_ERR_UNKNOWN, true, "-exp_id is required");
+        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;
+    }
+    psString stats = psMetadataLookupStr(&status, config->args, "-stats");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -stats");
+        return false;
+    }
+    if (!stats) {
+        psError(PS_ERR_UNKNOWN, true, "-stats is required");
+        return false;
+    }
+    psString recipe = psMetadataLookupStr(&status, config->args, "-recipe");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -recipe");
+        return false;
+    }
+    if (!recipe) {
+        psError(PS_ERR_UNKNOWN, true, "-recipe is required");
+        return false;
+    }
+
+    // check det_id, exp_id, & class_id against the input rawImfiles
+    
+    // we have to generate our own where claus as we want to exclude -stats
+    // from the search
+    psMetadata *where = psMetadataAlloc();
+    if (!psMetadataAddS32(where, PS_LIST_TAIL, "det_id", 0, "==",
+            (psS32)atoi(det_id))) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item det_id");
+        psFree(where);
+        return false;
+    }
+    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;
+    }
+    if (!psMetadataAddStr(where, PS_LIST_TAIL, "class_id", 0, "==", class_id)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item class_id");
+        psFree(where);
+        return false;
+    }
+
+    psArray *rawImfiles = searchRawImfiles(config, where);
+    psFree(where);
+    if (!rawImfiles) {
+        psError(PS_ERR_UNKNOWN, true,
+    "det_id %s, exp_id %s, class_id %s does not corespond to an input imfile",
+            det_id, exp_id, class_id);
+        return false;
+    }
+
+    // database sanity check
+    if (psArrayLength(rawImfiles) > 1) {
+        // abort
+    }
+
     return true;
 }
Index: /trunk/ippTools/src/dettoolConfig.c
===================================================================
--- /trunk/ippTools/src/dettoolConfig.c	(revision 7334)
+++ /trunk/ippTools/src/dettoolConfig.c	(revision 7335)
@@ -176,8 +176,10 @@
         "define detrend ID (required)", NULL);
     psMetadataAddStr(addresidArgs, PS_LIST_TAIL, "-class_id",  0,
-        "define class ID", NULL);
+        "define class ID (required)", NULL);
     psMetadataAddStr(addresidArgs, PS_LIST_TAIL, "-stats",  0,
-        "define stats", NULL);
-    psMetadataAddBool(addresidArgs, PS_LIST_TAIL, "-accpet",  0,
+        "define stats (required)", NULL);
+    psMetadataAddStr(addresidArgs, PS_LIST_TAIL, "-recipe",  0,
+        "define recipe (required)", NULL);
+    psMetadataAddBool(addresidArgs, PS_LIST_TAIL, "-accept",  0,
         "define as having acceptable residuals", false);
 
