Index: trunk/ppImage/src/ppImageBurntoolMask.c
===================================================================
--- trunk/ppImage/src/ppImageBurntoolMask.c	(revision 25299)
+++ trunk/ppImage/src/ppImageBurntoolMask.c	(revision 26895)
@@ -3,5 +3,5 @@
 #endif
 
-/* #define PPIMAGE_BURNTOOL_DEBUG 1 */
+#define PPIMAGE_BURNTOOL_DEBUG 0
 
 #include "ppImage.h"
@@ -23,5 +23,5 @@
     return(false);
   }
-  long Nrows = psFitsTableSize(fits);  
+  long Nrows = psFitsTableSize(fits);
 
   long row = 0;
@@ -33,8 +33,8 @@
   psImage *image = mask->mask;
 
-  
+
   /* Set the maskValue from the recipes. */
   psImageMaskType maskValue = options->burntoolMask;
-#ifdef PPIMAGE_BURNTOOL_DEBUG
+#if PPIMAGE_BURNTOOL_DEBUG
   psLogMsg("ppImageBurntoolMask", 4, "Status: %ld %d\n",Nrows,maskValue);
 #endif
@@ -47,44 +47,44 @@
 
     if (psMetadataLookupS32(&status,rowMD,"cell") == burntool_cell) {
-      if (((options->burntoolTrails & 0x01)&&(psMetadataLookupS32(&status,rowMD,"nfit") == 0))||
-	  ((options->burntoolTrails & 0x02)&&(psMetadataLookupS32(&status,rowMD,"up") == 1))||
-	  ((options->burntoolTrails & 0x04)&&(psMetadataLookupS32(&status,rowMD,"up") == 0))) {
-	/*       If the fit fails, burntool reports zero here.  This
-		 signifies that it expected to see a trail (else why
-		 fit) but did not find it when it attempted to
-		 correct. */
-#ifdef PPIMAGE_BURNTOOL_DEBUG
-	psLogMsg ("ppImageBurntoolMask", 4, "Masking! %d (%d %d %d) %d %d",
-		  psMetadataLookupS32(&status,rowMD,"cell"),
-		  ((options->burntoolTrails & 0x0001)&&(psMetadataLookupS32(&status,rowMD,"nfit") == 0)),
-		  ((options->burntoolTrails & 0x02)&&(psMetadataLookupS32(&status,rowMD,"up") == 1)),
-		  ((options->burntoolTrails & 0x04)&&(psMetadataLookupS32(&status,rowMD,"up") == 0)),
-		  options->burntoolTrails,
-		  maskValue
-		  );
+      if (((options->burntoolTrails & 0x01)&&(psMetadataLookupS32(&status,rowMD,"func") == 4))||
+          (((options->burntoolTrails & 0x02)&&(psMetadataLookupS32(&status,rowMD,"up") == 1))||
+           ((options->burntoolTrails & 0x04)&&(psMetadataLookupS32(&status,rowMD,"up") == 0)))) {
+        /*       If the fit fails, burntool reports zero here.  This
+                 signifies that it expected to see a trail (else why
+                 fit) but did not find it when it attempted to
+                 correct. */
+#if PPIMAGE_BURNTOOL_DEBUG
+        psLogMsg ("ppImageBurntoolMask", 4, "Masking! %d (%d %d %d) %d %d",
+                  psMetadataLookupS32(&status,rowMD,"cell"),
+                  ((options->burntoolTrails & 0x0001)&&(psMetadataLookupS32(&status,rowMD,"nfit") == 0)),
+                  ((options->burntoolTrails & 0x02)&&(psMetadataLookupS32(&status,rowMD,"up") == 1)),
+                  ((options->burntoolTrails & 0x04)&&(psMetadataLookupS32(&status,rowMD,"up") == 0)),
+                  options->burntoolTrails,
+                  maskValue
+                  );
 #endif
-	for (int i = psMetadataLookupS32(&status,rowMD,"sxfit");
-	     i <= psMetadataLookupS32(&status,rowMD,"exfit");
-	     i++) {
+        for (int i = psMetadataLookupS32(&status,rowMD,"sxfit");
+             i <= psMetadataLookupS32(&status,rowMD,"exfit");
+             i++) {
 
-	  if (psMetadataLookupS32(&status,rowMD,"up") == 0) {
-	    for (int j = 0; j <= psMetadataLookupS32(&status,rowMD,"y1p"); j++) {
-/* #ifdef PPIMAGE_BURNTOOL_DEBUG */
-/* 	      psLogMsg("ppImageBurntoolMask", 4, "Noisy!: %d %d %d %d\n", */
-/* 		       i,j,image->data.PS_TYPE_IMAGE_MASK_DATA[j][i],maskValue); */
-/* #endif */
-	      image->data.PS_TYPE_IMAGE_MASK_DATA[j][i] |= maskValue;
-	    }
-	  }
-	  else {
-	    for (int j = psMetadataLookupS32(&status,rowMD,"y1m"); j < image->numRows ; j++) {
-/* #ifdef PPIMAGE_BURNTOOL_DEBUG */
-/* 	      psLogMsg("ppImageBurntoolMask", 4, "Noisy!: %d %d %d %d\n", */
-/* 		       i,j,image->data.PS_TYPE_IMAGE_MASK_DATA[j][i],maskValue); */
-/* #endif */
-	      image->data.PS_TYPE_IMAGE_MASK_DATA[j][i] |= maskValue;
-	    }
-	  }
-	}
+          if (psMetadataLookupS32(&status,rowMD,"up") == 0) {
+            for (int j = 0; j <= psMetadataLookupS32(&status,rowMD,"y1p"); j++) {
+#if PPIMAGE_BURNTOOL_DEBUG
+              psLogMsg("ppImageBurntoolMask", 4, "Noisy!: %d %d %d %d\n",
+                       i,j,image->data.PS_TYPE_IMAGE_MASK_DATA[j][i],maskValue);
+#endif
+              image->data.PS_TYPE_IMAGE_MASK_DATA[j][i] |= maskValue;
+            }
+          }
+          else {
+            for (int j = psMetadataLookupS32(&status,rowMD,"y1m"); j < image->numRows ; j++) {
+#if PPIMAGE_BURNTOOL_DEBUG
+              psLogMsg("ppImageBurntoolMask", 4, "Noisy!: %d %d %d %d\n",
+                       i,j,image->data.PS_TYPE_IMAGE_MASK_DATA[j][i],maskValue);
+#endif
+              image->data.PS_TYPE_IMAGE_MASK_DATA[j][i] |= maskValue;
+            }
+          }
+        }
 
       }
@@ -95,6 +95,2 @@
   return(status);
 }
-	    
-
-
-    
