Index: /trunk/psphot/src/psphotArguments.c
===================================================================
--- /trunk/psphot/src/psphotArguments.c	(revision 10426)
+++ /trunk/psphot/src/psphotArguments.c	(revision 10427)
@@ -13,5 +13,5 @@
 
     // load config data from default locations
-    pmConfig *config = pmConfigRead(&argc, argv);
+    pmConfig *config = pmConfigRead(&argc, argv, "PSPHOT");
     if (config == NULL) {
         psError(PSPHOT_ERR_CONFIG, false, "Can't read site configuration");
@@ -19,9 +19,24 @@
     }
 
-    // save the recipe options separately until we have loaded the recipe (psphotParseDetrend)
-    psMetadata *options = psMetadataAlloc ();
-    psMetadataAddPtr (config->arguments, PS_LIST_TAIL, "PSPHOT.OPTIONS",  PS_DATA_METADATA, "", options);
+    // save the following additional recipe values based on command-line options
+    // these options override the PSPHOT recipe values loaded from recipe files
 
-    // the following options override the PSPHOT recipe options
+    // if the recipe is already defined in config->arguments, supplement
+    // save the recipe options onto config->arguments:RECIPES
+    psMetadata *recipes = psMetadataLookupMetadata(NULL, config->arguments, "RECIPES");
+    if (!recipes) {
+	recipes = psMetadataAlloc ();
+	psMetadataAddPtr (config->arguments, PS_LIST_TAIL, "RECIPES",  PS_DATA_METADATA, "", recipes);
+    } else {
+	psMemIncrRefCounter (recipes); // so we can free options below if not allocated here
+    }
+    // look for the recipe defined in recipes
+    psMetadata *options = psMetadataLookupMetadata(NULL, recipes, "PSPHOT");
+    if (!options) {
+	options = psMetadataAlloc ();
+	psMetadataAddPtr (recipes, PS_LIST_TAIL, "PSPHOT",  PS_DATA_METADATA, "", options);
+    } else {
+	psMemIncrRefCounter (options); // so we can free options below if not allocated here
+    }
 
     // run the test model (requires X,Y coordinate)
@@ -83,42 +98,7 @@
     }
 
-    // other arbitrary recipe values: -D key value (all added as string)
-    while ((N = psArgumentGet (argc, argv, "-D"))) {
-        psArgumentRemove (N, &argc, argv);
-        psMetadataAddStr (options, PS_LIST_TAIL, argv[N], 0, "", argv[N+1]);
-        psArgumentRemove (N, &argc, argv);
-        psArgumentRemove (N, &argc, argv);
-    }
-
-    // other arbitrary recipe values: -Df key value (all added as float)
-    while ((N = psArgumentGet (argc, argv, "-Db"))) {
-        psArgumentRemove (N, &argc, argv);
-	if (!strcasecmp (argv[N+1], "true")) {
-	    psMetadataAddBool (options, PS_LIST_TAIL, argv[N], 0, "", true);
-	} else {
-	    psMetadataAddBool (options, PS_LIST_TAIL, argv[N], 0, "", false);
-	}
-        psArgumentRemove (N, &argc, argv);
-        psArgumentRemove (N, &argc, argv);
-    }
-
-    // other arbitrary recipe values: -Df key value (all added as float)
-    while ((N = psArgumentGet (argc, argv, "-Df"))) {
-        psArgumentRemove (N, &argc, argv);
-        psMetadataAddF32 (options, PS_LIST_TAIL, argv[N], 0, "", atof(argv[N+1]));
-        psArgumentRemove (N, &argc, argv);
-        psArgumentRemove (N, &argc, argv);
-    }
-
-    // other arbitrary recipe values: -Di key value (all added as int)
-    while ((N = psArgumentGet (argc, argv, "-Di"))) {
-        psArgumentRemove (N, &argc, argv);
-        psMetadataAddS32 (options, PS_LIST_TAIL, argv[N], 0, "", atoi(argv[N+1]));
-        psArgumentRemove (N, &argc, argv);
-        psArgumentRemove (N, &argc, argv);
-    }
-
-    // drop the local view on the options (saved on config->arguments)
+    // drop the local view on the options (saved in config->arguments)
     psFree (options);
+    psFree (recipes);
 
     // the input file is a required argument; if not found, we will exit
Index: /trunk/psphot/src/psphotParseCamera.c
===================================================================
--- /trunk/psphot/src/psphotParseCamera.c	(revision 10426)
+++ /trunk/psphot/src/psphotParseCamera.c	(revision 10427)
@@ -14,9 +14,8 @@
 
     // select recipe options supplied on command line
-    psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes,   "PSPHOT");
-    psMetadata *options = psMetadataLookupPtr (&status, config->arguments, "PSPHOT.OPTIONS");
-    psMetadataCopy (recipe, options);
+    psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, "PSPHOT");
 
     // set default recipe values here
+    // XXX drop this?  we put this in the default recipe?
     psMetadataAddStr (recipe, PS_LIST_TAIL, "FITMODE",         PS_META_NO_REPLACE, "default fitting mode", "NONE");
     psMetadataAddStr (recipe, PS_LIST_TAIL, "PHOTCODE",        PS_META_NO_REPLACE, "default photcode",     "NONE");
@@ -75,4 +74,5 @@
 
     // Chip selection: turn on only the chips specified (pass status to suppress missing-key log msg)
+    // XXX why not put this in the recipe?
     char *chipLine = psMetadataLookupStr(&status, config->arguments, "CHIP_SELECTIONS");
     psArray *chips = psStringSplitArray (chipLine, ",", false);
