Index: branches/eam_branches/relphot.20210521/src/setMrelFinal.c
===================================================================
--- branches/eam_branches/relphot.20210521/src/setMrelFinal.c	(revision 41623)
+++ branches/eam_branches/relphot.20210521/src/setMrelFinal.c	(revision 41624)
@@ -27,9 +27,12 @@
   ALLOCATE (catalog[0].measureRank, char, catalog[0].Nmeasure);
   setMeasureRank (catalog);
+
+  setMflatFromGrid (catalog); // Mgrid is used to set Mflat; Mgrid is the ignored in setMrelOutput / setMrelCatalog
   setMrelOutput (catalog, 1); // sets the values secfilt.MpsfChp = <measure.M - image.Mcal - measure.Mflat>
   setMcalOutput (catalog, 1); // sets measure.Mcal = image.Mcal
 
-  /* clear ID_OBJ_POOR, ID_OBJ_FEW values before writing ??? */
-  /* ID_MEAS_NOCAL is an internal bit, so it should be cleared */
+  // clear ID_OBJ_POOR, ID_OBJ_FEW, ID_MEAS_NOCAL values before writing 
+  // These are internal bits, so they should be cleared
+  // XXX are these still used?
   // XXX eventually: move these internal flags to an internal-only catalog->FOO element (like found)
   for (i = 0; i < catalog[0].Naverage; i++) {
@@ -83,4 +86,5 @@
 int print_measure_set (Average *average, SecFilt *secfilt, Measure *measure);
 
+// XXX this function is no longer used:
 void skip_measurements (Catalog *catalog, int pass) {
 
