Index: trunk/psModules/src/objects/pmSourceIO_CFF.c
===================================================================
--- trunk/psModules/src/objects/pmSourceIO_CFF.c	(revision 36623)
+++ trunk/psModules/src/objects/pmSourceIO_CFF.c	(revision 36633)
@@ -126,5 +126,7 @@
         pmModel *model = pmModelAlloc (modelType);
         source->modelPSF  = model;
-        source->type = PM_SOURCE_TYPE_STAR; // XXX this should be added to the flags
+//        RoughClass wants source type to be unknown
+//        source->type = PM_SOURCE_TYPE_STAR; // XXX this should be added to the flags
+        source->type = PM_SOURCE_TYPE_UNKNOWN;
 
 	// XXX we can set this in general, but for a specific image, we need to weed out SATSTARS and
@@ -178,6 +180,8 @@
 	source->moments->My = Y;
 	source->moments->Mrf = kronRadius * 0.4; // kronRadius is 2.5 * first radial moment
-	source->tmpFlags |= PM_SOURCE_TMPF_MOMENTS_MEASURED;
-	// XXX does the above cause a problem with pmSourceMoments (do we run it? yes we do)
+
+        // Don't mark the moments as measured because that causes many fields to be left blank.
+        // The moments code knows not to change the position or the Mrf for external sources
+        // source->tmpFlags |= PM_SOURCE_TMPF_MOMENTS_MEASURED;
 
 	if (isfinite(petRadius)) {
@@ -246,4 +250,12 @@
 
     pmModelType sersicModelType = pmModelClassGetType("PS_MODEL_SERSIC");
+
+    psString modelToChoose = psMetadataLookupStr(&mdok, recipe, "EXT_MODEL_TYPE_FOR_CFF");
+    pmModelType selectedModelType = -1;
+    if (mdok && modelToChoose != NULL) {
+        if (strcmp(modelToChoose, "BEST")) {
+            selectedModelType = pmModelClassGetType(modelToChoose);
+        }
+    }
 
     for (int i = 0; i < sources->n; i++) {
@@ -273,12 +285,9 @@
             theta = 0;
         } else {
-            // Choose the extended model to use for this source.
-            // For now we use the one set as the modelEXT for this source which had the best fit.
-            // XXX: make this controllable by recipe
-            //   use best (as implemented here)
-            //   choose specific type
+            //   Find the model with the selected type. If selected type is -1 choose the one selected ad
+            //   modelEXT which was the best
             int iModel = -1;
             if (source->modelEXT) {
-                pmModelType ext_model_type = source->modelEXT->type;
+                pmModelType ext_model_type =  selectedModelType != -1  ? selectedModelType : source->modelEXT->type;
                 for (int j=0; j<source->modelFits->n; j++) {
                     pmModel *aModel = source->modelFits->data[j];
