Index: trunk/ippTools/src/regtool.c
===================================================================
--- trunk/ippTools/src/regtool.c	(revision 8281)
+++ trunk/ippTools/src/regtool.c	(revision 8285)
@@ -62,7 +62,9 @@
     PS_ASSERT_PTR_NON_NULL(config, false);
 
-    // return only exps that are not in rawScienceExp or rawDetrendExp and have
-    // ALL of their imfiles in rawImfile (by count) and have no associated
-    // imfiles left in newImfile
+    // return only exps that:
+    // are not in rawScienceExp 
+    // are not in rawDetrendExp 
+    // have ALL of their imfiles in rawImfile (by count)
+    // and have no associated imfiles left in newImfile
 
     char *query =
@@ -116,6 +118,8 @@
     PS_ASSERT_PTR_NON_NULL(config, false);
 
-    // select newImfiles who's exp_id is in newExp AND don't have their exp_id
-    // in rawScienceExp or rawDetrendExp
+    // select newImfiles that:
+    // exp_id is in newExp
+    // don't have their exp_id in rawScienceExp 
+    // don't have their exp_id in rawDetrendExp
     // XXX having the same exp_id in newExp and raw*Exp is probably an error
     // that should be checked for
@@ -328,4 +332,5 @@
         psArray *rawImfiles = NULL;
         {
+            // build a query to search by exp_id
             psMetadata *where = psMetadataAlloc();
             if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==", newExp->exp_id)) {
@@ -343,5 +348,5 @@
             psFree(where);
         }
-        // sanity check the number of rawImfiles found
+        // sanity check that least results were found
         if (!rawImfiles) {
             // rollback
@@ -354,4 +359,5 @@
             return false;
         }
+        // sanity check the number of rawImfiles found
         if (psArrayLength(rawImfiles) != newExp->imfiles) {
             // rollback
@@ -416,4 +422,5 @@
     char *whereClaus = NULL;
     {
+        // build a query to search by exp_id, class, class_id
         psMetadata *where = psMetadataAlloc();
         bool status = false;
@@ -485,5 +492,7 @@
 
         for (long i = 0; i < psArrayLength(newImfiles); i++) {
+            // convert newImfile metadata -> newImfile object
             newImfileRow *object = newImfileObjectFromMetadata(newImfiles->data[i]);
+            // convert newImfile object -> rawImfile object
             rawImfileRow *imfile = newToRawImfile(config, object); 
             if (!imfile) {
@@ -497,4 +506,5 @@
                 return false;
             }
+            // insert the rawImfile object into the database
             if (!rawImfileInsertObject(config->dbh, imfile)) {
                 // rollback
@@ -509,4 +519,5 @@
             }
             psFree(imfile);
+            // remove the neImfile object from the database
             if (!newImfileDeleteObject(config->dbh, object)) {
                 // rollback
@@ -539,4 +550,5 @@
     PS_ASSERT_PTR_NON_NULL(config, false);
 
+    // find all rawImfiles matching the default query
     psArray *rawImfiles = rawImfileSelectRowObjects(config->dbh, config->where, 0);
     if (!rawImfiles) {
