Index: trunk/ippTools/src/dettool.c
===================================================================
--- trunk/ippTools/src/dettool.c	(revision 7353)
+++ trunk/ippTools/src/dettool.c	(revision 7363)
@@ -25,4 +25,5 @@
 static bool addresidMode(pxConfig *config);
 static bool residMode(pxConfig *config);
+static bool addresidexpMode(pxConfig *config);
 
 static detInputExpRow *rawDetrenTodetInputExpRow(rawDetrendExpRow *rawExp, psS32 det_id);
@@ -101,4 +102,9 @@
         case DETTOOL_MODE_RESID:
             if (residMode(config)) {
+                goto FAIL;
+            }
+            break;
+        case DETTOOL_MODE_ADDRESIDEXP:
+            if (addresidexpMode(config)) {
                 goto FAIL;
             }
@@ -1495,2 +1501,8 @@
     return true;
 }
+
+static bool addresidexpMode(pxConfig *config)
+{
+    PS_ASSERT_PTR_NON_NULL(config, false);
+    return true;
+}
Index: trunk/ippTools/src/dettool.h
===================================================================
--- trunk/ippTools/src/dettool.h	(revision 7353)
+++ trunk/ippTools/src/dettool.h	(revision 7363)
@@ -20,4 +20,5 @@
     DETTOOL_MODE_ADDRESID,
     DETTOOL_MODE_RESID,
+    DETTOOL_MODE_ADDRESIDEXP
 } dettoolMode;
 
Index: trunk/ippTools/src/dettoolConfig.c
===================================================================
--- trunk/ippTools/src/dettoolConfig.c	(revision 7353)
+++ trunk/ippTools/src/dettoolConfig.c	(revision 7363)
@@ -181,8 +181,6 @@
     psMetadataAddStr(addresidArgs, PS_LIST_TAIL, "-recipe",  0,
         "define recipe (required)", NULL);
-    psMetadataAddBool(addresidArgs, PS_LIST_TAIL, "-accept",  0,
-        "define as having acceptable residuals", false);
-
-    // -normalizedframe
+
+    // -resid
     psMetadata *residArgs = psMetadataAlloc();
     psMetadataAddStr(residArgs, PS_LIST_TAIL, "-det_id",  0,
@@ -196,4 +194,21 @@
     psMetadataAddStr(residArgs, PS_LIST_TAIL, "-recipe",  0,
         "search for recipe", NULL);
+ 
+    // -addresidexp
+    psMetadata *addresidexpArgs = psMetadataAlloc();
+    psMetadataAddStr(addresidexpArgs, PS_LIST_TAIL, "-det_id",  0,
+        "define detrend ID (required)", NULL);
+    psMetadataAddStr(addresidexpArgs, PS_LIST_TAIL, "-iter",  0,
+        "define iteration number", NULL);
+    psMetadataAddStr(addresidexpArgs, PS_LIST_TAIL, "-exp_id",  0,
+        "define detrend ID (required)", NULL);
+    psMetadataAddStr(addresidexpArgs, PS_LIST_TAIL, "-class_id",  0,
+        "define class ID (required)", NULL);
+    psMetadataAddStr(addresidexpArgs, PS_LIST_TAIL, "-stats",  0,
+        "define stats (required)", NULL);
+    psMetadataAddStr(addresidexpArgs, PS_LIST_TAIL, "-recipe",  0,
+        "define recipe (required)", NULL);
+    psMetadataAddBool(addresidexpArgs, PS_LIST_TAIL, "-accept",  0,
+        "define as having acceptable residuals", false);
 
 #define PXTOOL_MODE(option, modeval, argset) \
@@ -231,4 +246,5 @@
     PXTOOL_MODE("-addresid",        DETTOOL_MODE_ADDRESID,      addresidArgs);
     PXTOOL_MODE("-resid",           DETTOOL_MODE_RESID,         residArgs);
+    PXTOOL_MODE("-addresidexp",     DETTOOL_MODE_ADDRESIDEXP,  addresidexpArgs);
 
     bool argErr = false;
@@ -244,5 +260,5 @@
         printf("\nPan-STARRS Detrend Tool\n");
         printf("Usage: %s <mode> [<options>]\n\n", argv[0]);
-        printf(" <mode> : [-define|-raw|-addprocessed|-processed|-addstacked|-stacked|-stackedframe|-addnormalized|-normalized|-normalizedframe]\n\n");
+        printf(" <mode> : [-define|-raw|-addprocessed|-processed|-addstacked|-stacked|-stackedframe|-addnormalized|-normalized|-normalizedframe|-addresid|-resid|-addresidexp]\n\n");
         fprintf (stdout, "-define ");
         psArgumentHelp(defineArgs);
@@ -287,4 +303,7 @@
         psArgumentHelp(residArgs);
         psFree(residArgs);
+        fprintf (stdout, "-addresidexp ");
+        psArgumentHelp(addresidexpArgs);
+        psFree(addresidexpArgs);
 
         exit(EXIT_FAILURE);
@@ -303,4 +322,5 @@
     psFree(addresidArgs);
     psFree(residArgs);
+    psFree(addresidexpArgs);
 
     // setup search criterion
