Index: /trunk/ppMerge/src/ppMergeCombine.c
===================================================================
--- /trunk/ppMerge/src/ppMergeCombine.c	(revision 9953)
+++ /trunk/ppMerge/src/ppMergeCombine.c	(revision 9954)
@@ -78,4 +78,5 @@
 #endif
 
+#if 0
 // Write fringe extensions
 static void writeFringes(psMetadata *fringes, // Table of extensions with fringe statistics to write
@@ -103,5 +104,5 @@
     return;
 }
-
+#endif
 
 // Combine the inputs
@@ -128,5 +129,4 @@
     // Iterate over the FPA
     pmFPA *fpa = data->out;             // Output FPA
-    psMetadata *fringeExtns = psMetadataAlloc(); // List of fringe extensions to write
     pmFPAview *view = pmFPAviewAlloc(0);// View of FPA, for iteration
     int cellNum = -1;                   // Cell number in the whole FPA
@@ -319,13 +319,6 @@
                 fringes->data[0] = fringe;
 
-                const char *chipName = psMetadataLookupStr(NULL, chip->concepts, "CHIP.NAME"); // Name of chip
-                const char *cellName = psMetadataLookupStr(NULL, cell->concepts, "CELL.NAME"); // Name of cell
-                psString extname = NULL;
-                psStringAppend(&extname, "FRINGE_%s_%s", chipName, cellName);
-
-                psMetadataAdd(fringeExtns, PS_LIST_TAIL, extname, PS_DATA_UNKNOWN,
-                              "Fringe data to write", fringes);
-                psFree(fringes);
-                psFree(extname);
+                pmFringesFormat(cell, NULL, fringes);
+                psFree(fringes);        // Drop reference
             }
 
@@ -351,12 +344,12 @@
 
             // Write the pixels
-            if (cell->hdu) {
+            if (cell->hdu && !cell->hdu->blankPHU) {
                 psTrace("ppMerge", 5, "Writing out cell HDU.\n");
                 pmCellWrite(cell, data->outFile, config->database, false);
+                if (options->fringe) {
+                    pmCellWriteTable(data->outFile, cell, "FRINGE");
+                }
+
                 pmCellFreeData(cell);
-
-                if (options->fringe) {
-                    writeFringes(fringeExtns, data->outFile);
-                }
             }
         }
@@ -370,19 +363,13 @@
 
         // Write the pixels
-        if (chip->hdu) {
+        if (chip->hdu && !chip->hdu->blankPHU) {
             psTrace("ppMerge", 5, "Writing out chip HDU.\n");
             pmChipWrite(chip, data->outFile, config->database, false, false);
+            if (options->fringe) {
+                pmChipWriteTable(data->outFile, chip, "FRINGE");
+            }
+
             pmChipFreeData(chip);
-
-            if (options->fringe) {
-                writeFringes(fringeExtns, data->outFile);
-            }
-        }
-    }
-
-    if (data->out->hdu) {
-        // Write the pixels
-        psTrace("ppMerge", 5, "Writing out FPA HDU.\n");
-        pmFPAWrite(data->out, data->outFile, config->database, false, false);
+        }
     }
 
@@ -391,9 +378,15 @@
         pmFPA *fpaIn = data->in->data[i]; // Input FPA
         pmFPAFreeData(fpaIn);
-
+    }
+
+    if (data->out->hdu && !data->out->hdu->blankPHU) {
+        // Write the pixels
+        psTrace("ppMerge", 5, "Writing out FPA HDU.\n");
+        pmFPAWrite(data->out, data->outFile, config->database, false, false);
         if (options->fringe) {
-            writeFringes(fringeExtns, data->outFile);
-        }
-    }
+            pmFPAWriteTable(data->outFile, fpa, "FRINGE");
+        }
+    }
+
     pmFPAFreeData(data->out);
 
