Index: /trunk/archive/scripts/src/phase2/ipprc.config
===================================================================
--- /trunk/archive/scripts/src/phase2/ipprc.config	(revision 5582)
+++ /trunk/archive/scripts/src/phase2/ipprc.config	(revision 5583)
@@ -8,7 +8,8 @@
 ### Setups for each camera system
 CAMERAS		METADATA
+#	MEGACAM_SINGLE	STR	megacam_single.config
 	MEGACAM_RAW	STR	megacam_raw.config
-#	MEGACAM_SPLICE	STR	megacam_splice.config
-#	GPC1_RAW	STR	gpc1_raw.config
+	MEGACAM_SPLICE	STR	megacam_splice.config
+	GPC1_RAW	STR	gpc1_raw.config
 #	LRIS_BLUE	STR	lris_blue.config
 #	LRIS_RED	STR	lris_red.config
Index: /trunk/archive/scripts/src/phase2/megacam_raw.config
===================================================================
--- /trunk/archive/scripts/src/phase2/megacam_raw.config	(revision 5582)
+++ /trunk/archive/scripts/src/phase2/megacam_raw.config	(revision 5583)
@@ -165,5 +165,5 @@
 	MASK.SOURCE	STR	FILE		# Source type for mask: EXT | FILE
 	MASK.NAME	STR	%a_mask.fits	# Name for mask extension or filename
-	WEIGHT.SOURCE	STR	EXT		# Source type for weight: EXT | FILE
-	WEIGHT.NAME	STR	%f-weight	# Name for weight extension or filename
+	WEIGHT.SOURCE	STR	FILE		# Source type for weight: EXT | FILE
+	WEIGHT.NAME	STR	%a_weight.fits	# Name for weight extension or filename
 END
Index: /trunk/archive/scripts/src/phase2/papPhase2.c
===================================================================
--- /trunk/archive/scripts/src/phase2/papPhase2.c	(revision 5582)
+++ /trunk/archive/scripts/src/phase2/papPhase2.c	(revision 5583)
@@ -149,19 +149,4 @@
     }
 
-#if 0
-    psString outputMaskName = psStringCopy(outputName);
-    (void)psStringAppend(&outputMaskName, ".mask");
-#ifdef PRODUCTION
-    psFits *outputMaskFile = psFitsOpen(outputMaskName, "w");
-#else
-    psFits *outputMaskFile = psFitsAlloc(outputMaskName);
-#endif
-    if (! outputMaskFile) {
-	psErrorStackPrint(stderr, "Can't open output mask image: %s\n", outputMaskName);
-	exit(EXIT_FAILURE);
-    }
-    psFree(outputMaskName);
-#endif
-
     // Get camera configuration from header if not already defined
     if (! camera) {
@@ -298,4 +283,5 @@
 	exit(EXIT_FAILURE);
     }
+
 #ifdef PRODUCTION
     psFitsClose(inputFile);
@@ -304,6 +290,8 @@
 #endif
 
-
-#if 1
+#if 0
+    pmFPAReadMask(input, inputFile);
+    pmFPAReadWeight(input, inputFile);
+#else
     {
 	// Generate mask and weight frame
@@ -353,5 +341,7 @@
 #endif
 
-    //pmFPAPrint(input);
+#if 0
+    pmFPAPrint(input);
+#endif
 
     // Load the calibration frames, if required
@@ -825,8 +815,6 @@
 #ifdef PRODUCTION
     psFitsClose(outputFile);
-//    psFitsClose(outputMaskFile);
 #else
     psFree(outputFile);
-//    psFree(outputMaskFile);
 #endif
 
Index: /trunk/archive/scripts/src/phase2/pmConfig.c
===================================================================
--- /trunk/archive/scripts/src/phase2/pmConfig.c	(revision 5582)
+++ /trunk/archive/scripts/src/phase2/pmConfig.c	(revision 5583)
@@ -177,4 +177,5 @@
 	if (! headerItem || headerItem->type != ruleItem->type) {
 	    match = false;
+	    break;
 	}
 
Index: /trunk/archive/scripts/src/phase2/pmFPAConceptsSet.c
===================================================================
--- /trunk/archive/scripts/src/phase2/pmFPAConceptsSet.c	(revision 5582)
+++ /trunk/archive/scripts/src/phase2/pmFPAConceptsSet.c	(revision 5583)
@@ -621,8 +621,13 @@
 		    while (biassec = psListGetAndIncrement(biassecsIter)) {
 			psListIteratorSet(checkListIter, PS_LIST_HEAD);
-			psRegion *checkRegion = NULL; // Region from iteration
+			psString checkRegionString = NULL; // Region string from iteration
 			int i = 0;		// Counter
-			while (checkRegion = psListGetAndIncrement(checkListIter)) {
-			    if (COMPARE_REGIONS(biassec, checkRegion)) {
+			while (checkRegionString = psListGetAndIncrement(checkListIter)) {
+			    psRegion checkRegion = psRegionFromString(checkRegionString);
+			    psTrace(__func__, 7, "Checking [%.0f:%.0f,%.0f:%.0f] against "
+				    "[%.0f:%.0f,%.0f:%.0f]\n", biassec->x0, biassec->x1, biassec->y0,
+				    biassec->y1, checkRegion.x0, checkRegion.x1, checkRegion.y0,
+				    checkRegion.y1);
+			    if (COMPARE_REGIONS(biassec, &checkRegion)) {
 				check->data.U8[i] = 1;
 				i++;
@@ -707,4 +712,5 @@
 	    psMetadataItem *binItem = psMetadataItemAllocStr(xKeyword, "Binning factor in x and y",
 							     binString);
+	    psFree(binString);
 	    psMetadata *header = NULL; // The FITS header
 	    if (cell->hdu) {
Index: /trunk/archive/scripts/src/phase2/pmFPAConstruct.c
===================================================================
--- /trunk/archive/scripts/src/phase2/pmFPAConstruct.c	(revision 5582)
+++ /trunk/archive/scripts/src/phase2/pmFPAConstruct.c	(revision 5583)
@@ -141,6 +141,4 @@
 		    }
 		    // The cell
-		    psArray *images = NULL;
-		    psMetadata *header = NULL;
 		    psMetadata *cellData = getCellData(camera, cellType);
 		    pmCell *cell = pmCellAlloc(chip, cellData, extName); // The cell
@@ -242,10 +240,10 @@
 		const char *cellType = contentItem->data.V; // The type of cell
 		psTrace(__func__, 5, "Cell type is %s\n", cellType);
-		psArray *images = NULL;
-		psMetadata *header = NULL;
 		psMetadata *cellData = getCellData(camera, cellType);
 		pmCell *cell = pmCellAlloc(chip, cellData, extName); // The cell
 //		psFree(cellData);
 		cell->hdu = p_pmHDUAlloc(extName); // Prepare cell to receive FITS data
+
+		psFree(cell);
 	    } // Iterating through contents
 	    psFree(contentsIter);
@@ -256,4 +254,6 @@
 	    return NULL;
 	}
+	psFree(chipName);
+	psFree(chip);
 
     } else {
Index: /trunk/archive/scripts/src/phase2/pmFPARead.h
===================================================================
--- /trunk/archive/scripts/src/phase2/pmFPARead.h	(revision 5582)
+++ /trunk/archive/scripts/src/phase2/pmFPARead.h	(revision 5583)
@@ -15,5 +15,5 @@
 
 bool pmFPAReadMask(pmFPA *fpa,		// FPA to read into
-		     psFits *source	// Source FITS file (for the original data)
+		   psFits *source	// Source FITS file (for the original data)
     );
 
Index: /trunk/archive/scripts/src/phase2/pmFPAWrite.c
===================================================================
--- /trunk/archive/scripts/src/phase2/pmFPAWrite.c	(revision 5582)
+++ /trunk/archive/scripts/src/phase2/pmFPAWrite.c	(revision 5583)
@@ -64,4 +64,6 @@
 	status &= writeHDU(fits, fpa->hdu);
     }
+
+
 
     return status;
