Index: trunk/ppImage/src/ppImageBurntoolMask.c
===================================================================
--- trunk/ppImage/src/ppImageBurntoolMask.c	(revision 26895)
+++ trunk/ppImage/src/ppImageBurntoolMask.c	(revision 42395)
@@ -24,13 +24,14 @@
   }
   long Nrows = psFitsTableSize(fits);
-
   long row = 0;
 
   psLogMsg ("ppImageBurntoolMask", 4, "Inside burntool mask %ld", Nrows);
 
+  /* The new burntool tables and method coming into play in 2022 has a slightly different format (an extra column). Need to differentiate */
+  psS16 BURNTOOL_STATE_GOOD = psMetadataLookupS16(NULL, config->camera, "BURNTOOL.STATE.GOOD");
+
   /* Redirects and Memory juggling. */
   view->readout = 0;
   psImage *image = mask->mask;
-
 
   /* Set the maskValue from the recipes. */
@@ -64,27 +65,56 @@
                   );
 #endif
-        for (int i = psMetadataLookupS32(&status,rowMD,"sxfit");
+
+        /* do separate masking strategy for old (14 and lower) and new burntool tables*/
+        if (BURNTOOL_STATE_GOOD >= 15) {
+          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++) {
-#if PPIMAGE_BURNTOOL_DEBUG
-              psLogMsg("ppImageBurntoolMask", 4, "Noisy!: %d %d %d %d\n",
+            if (psMetadataLookupS32(&status,rowMD,"up") == 0) {
+              for (int j = psMetadataLookupS32(&status,rowMD,"eyfit"); j <= psMetadataLookupS32(&status,rowMD,"y0"); 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;
+                #endif
+                image->data.PS_TYPE_IMAGE_MASK_DATA[j][i] |= maskValue;
+              }
+            } else {
+              for (int j = psMetadataLookupS32(&status,rowMD,"sy"); j < psMetadataLookupS32(&status,rowMD,"eyfit") ; 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",
+        } else {
+          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++) {
+                #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;
+                #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;
+              }
             }
           }
+
         }
+
 
       }
