Index: /trunk/PS-IPP-Config/lib/PS/IPP/Config.pm
===================================================================
--- /trunk/PS-IPP-Config/lib/PS/IPP/Config.pm	(revision 13936)
+++ /trunk/PS-IPP-Config/lib/PS/IPP/Config.pm	(revision 13937)
@@ -1,5 +1,5 @@
 # Copyright (c) 2006  Paul Price, Joshua Hoblitt
 #
-# $Id: Config.pm,v 1.61 2007-06-13 19:17:50 eugene Exp $
+# $Id: Config.pm,v 1.62 2007-06-22 00:10:10 price Exp $
 
 package PS::IPP::Config;
@@ -783,4 +783,37 @@
 }
 
+# Given a reduction class name (and a previously defined camera) and a
+# symbolic name for the recipe, return the actual name of the recipe.
+sub reduction
+{
+    my $self = shift;		# Configuration object
+    my $reduction = shift;	# Reduction class
+    my $name = shift;		# Symbolic name of recipe
+
+    unless (defined $self and defined $reduction and defined $name) {
+	carp "Programming error --- inputs undefined";
+	exit($PS_EXIT_PROG_ERROR);
+    }
+
+    my $camera = $self->{camera}; # Camera configuration
+    unless (defined $camera) {
+	carp "Camera has not yet been defined.\n";
+	return undef;
+    }
+    
+    my $classes = metadataLookupMD($camera, "REDUCTION") or # Reduction classes
+	(carp "Can't find REDUCTION in camera configuration.\n" and exit($PS_EXIT_CONFIG_ERROR));
+
+    my $class = metadataLookupMD($classes, $reduction) or # Class of interest
+	(carp "Can't find $reduction in REDUCTION in camera configuration.\n" and
+	 exit($PS_EXIT_CONFIG_ERROR));
+
+    my $actual = metadataLookupStr($class, $name) or # The actual recipe name of interest
+	(carp "Can't find $name in $class in REDUCTION in camera configuration.\n" and
+	 exit($PS_EXIT_CONFIG_ERROR));
+
+    return $actual;
+}
+
 # Interpolate environment variables in a directory (or colon-delimited list of directories)
 sub _interpolate_env
Index: /trunk/dbconfig/cam.md
===================================================================
--- /trunk/dbconfig/cam.md	(revision 13936)
+++ /trunk/dbconfig/cam.md	(revision 13937)
@@ -6,5 +6,5 @@
     workdir     STR         255 
     label       STR         64      # key
-    recipe      STR         64
+    reduction   STR         64
     expgroup    STR         64      # key
     dvodb       STR         255
@@ -17,5 +17,5 @@
     workdir        STR      255 
     label          STR      64      # key
-    recipe         STR      64
+    reduction      STR      64
     expgroup       STR      64      # key
     dvodb          STR      255
Index: /trunk/dbconfig/changes.txt
===================================================================
--- /trunk/dbconfig/changes.txt	(revision 13936)
+++ /trunk/dbconfig/changes.txt	(revision 13937)
@@ -12,2 +12,14 @@
 alter table diffSkyfile add column path_base varchar(255) NULL DEFAULT NULL after uri;
 alter table stackSumSkyfile add column path_base varchar(255) NULL DEFAULT NULL after uri;
+
+
+Version 1.1.22 --> 1.1.23
+# Adding support for reduction classes (which are used to specify recipes for parts of the pipeline).
+# Adding 'reduction' to detRun
+# Renaming 'recipe' in {chip,cam}{Pending,Processed}Exp to 'reduction'
+
+alter table detRun add column reduction varchar(64) NULL DEFAULT NULL after exp_type;
+alter table chipPendingExp change column recipe reduction varchar(64);
+alter table chipProcessedExp change column recipe reduction varchar(64);
+alter table camPendingExp change column recipe reduction varchar(64);
+alter table camProcessedExp change column recipe reduction varchar(64);
Index: /trunk/dbconfig/chip.md
===================================================================
--- /trunk/dbconfig/chip.md	(revision 13936)
+++ /trunk/dbconfig/chip.md	(revision 13937)
@@ -8,5 +8,5 @@
     workdir     STR         255 
     label       STR         64      # key
-    recipe      STR         64
+    reduction   STR         64      # Reduction class
     expgroup    STR         64      # key
     dvodb       STR         255
@@ -30,5 +30,5 @@
     workdir     STR         255 
     label       STR         64      # key
-    recipe      STR         64
+    reduction   STR         64
     expgroup    STR         64      # key
     dvodb       STR         255
Index: /trunk/dbconfig/config.md
===================================================================
--- /trunk/dbconfig/config.md	(revision 13936)
+++ /trunk/dbconfig/config.md	(revision 13937)
@@ -2,4 +2,4 @@
     pkg_name        STR     ippdb
     pkg_namespace   STR     ippdb
-    pkg_version     STR     1.1.22
+    pkg_version     STR     1.1.23
 END
Index: /trunk/dbconfig/det.md
===================================================================
--- /trunk/dbconfig/det.md	(revision 13936)
+++ /trunk/dbconfig/det.md	(revision 13937)
@@ -10,4 +10,5 @@
     telescope   STR         64
     exp_type    STR         64      # XXX this should be dropped
+    reduction   STR         64      # Reduction clas
     filter      STR         64
     airmass_min F32         0.0
Index: /trunk/ippScripts/scripts/chip_imfile.pl
===================================================================
--- /trunk/ippScripts/scripts/chip_imfile.pl	(revision 13936)
+++ /trunk/ippScripts/scripts/chip_imfile.pl	(revision 13937)
@@ -29,6 +29,4 @@
 use Pod::Usage qw( pod2usage );
 
-my $RECIPE = 'PPIMAGE_OBDSFRA'; # Recipe to use
-
 # Parse the command-line arguments
 my ($exp_id,			# Exposure identifier
@@ -36,8 +34,8 @@
     $class_id,			# Class identifier
     $input,			# Input FITS file
-    $recipe,			# Recipe to use
     $camera,			# Camera
     $dbname,			# Database name
     $workdir,			# Working directory, for output files
+    $reduction,			# Reduction class
     $no_update,			# Don't update the database?
     $no_op,			# Don't do any operations?
@@ -48,8 +46,8 @@
 	   'class_id=s'    => \$class_id,
 	   'uri|u=s'       => \$input,
-	   'recipe=s'      => \$recipe,
 	   'camera|c=s'    => \$camera,
 	   'dbname|d=s'    => \$dbname, # Database name
 	   'workdir|w=s'   => \$workdir,
+	   'reduction=s'   => \$reduction,
 	   'no-update'     => \$no_update,
 	   'no-op'         => \$no_op,
@@ -67,4 +65,6 @@
 
 $ipprc->define_camera($camera);
+$reduction = 'DEFAULT' unless defined $reduction;
+my $recipe = $ipprc->reduction($reduction, 'CHIP'); # Recipe to use
 
 # Look for programs we need
@@ -97,5 +97,5 @@
 
     my $command = "$ppImage -file $input $outputRoot";
-    $command .= " -recipe PPIMAGE $RECIPE";
+    $command .= " -recipe PPIMAGE $recipe";
     $command .= " -recipe PPSTATS CHIPSTATS";
     $command .= " -stats $outputStats"; # Command to run ppImage
@@ -130,6 +130,6 @@
 my $bg_stdev = ($stats->bg_stdev() or 'NAN');
 my $bg_mean_stdev = ($stats->bg_mean_stdev() or 'NAN');
-my $fringe_0 	  = (${$stats->fringe()[0]} or 'NAN');
-my $fringe_1 	  = (${$stats->fringe_err()[0]} or 'NAN');
+my $fringe_0 	  = (${$stats->fringe()}[0] or 'NAN');
+my $fringe_1 	  = (${$stats->fringe_err()}[0] or 'NAN');
 my $fringe_2 	  = 'NAN';
 
Index: /trunk/ippScripts/scripts/detrend_process_imfile.pl
===================================================================
--- /trunk/ippScripts/scripts/detrend_process_imfile.pl	(revision 13936)
+++ /trunk/ippScripts/scripts/detrend_process_imfile.pl	(revision 13937)
@@ -32,5 +32,5 @@
 use Pod::Usage qw( pod2usage );
 
-my ($det_id, $exp_tag, $class_id, $det_type, $input_uri, $camera, $dbname, $workdir, $no_update, $no_op);
+my ($det_id, $exp_tag, $class_id, $det_type, $input_uri, $camera, $dbname, $workdir, $reduction, $no_update, $no_op);
 GetOptions(
     'det_id|d=s'        => \$det_id,
@@ -42,4 +42,5 @@
     'dbname|d=s'        => \$dbname, # Database name
     'workdir|w=s'       => \$workdir, # Working directory, for output files
+    'reduction=s'       => \$reduction,	# Reduction class
     'no-update'         => \$no_update,
     'no-op'             => \$no_op,
@@ -60,14 +61,6 @@
 $ipprc->define_camera($camera);
 
-# Recipes to use, as a function of the detrend type
-use constant RECIPES => {
-    'bias'     => 'PPIMAGE_O',	  # Overscan only
-    'dark'     => 'PPIMAGE_OB',	  # Overscan and bias only
-    'shutter'  => 'PPIMAGE_OBD',  # Overscan, bias and dark only
-    'flat'     => 'PPIMAGE_OBDS', # Overscan, bias, dark and shutter only
-    'domeflat' => 'PPIMAGE_OBDS', # Overscan, bias, dark and shutter only
-    'skyflat'  => 'PPIMAGE_OBDS', # Overscan, bias, dark and shutter only
-    'fringe'   => 'PPIMAGE_OBDSF',# Overscan, bias, dark, shutter and flat only
-};
+$reduction = "DETREND" unless defined $reduction;
+my $recipe = $ipprc->reduction($reduction, $det_type . '_PROCESS'); # Recipe name to use
 
 # Look for programs we need
@@ -80,11 +73,4 @@
 }
 $ppImage .= " -dbname $dbname" if defined $dbname;
-
-# Recipe to use in processing
-my $recipe = RECIPES->{lc($det_type)};
-unless (defined $recipe) {
-    warn("Unrecognised detrend type: $det_type");
-    exit($PS_EXIT_CONFIG_ERROR);
-}
 
 $workdir = caturi( $workdir, "$camera.$det_type.$det_id" ) if defined $workdir;
Index: /trunk/ippScripts/scripts/detrend_resid.pl
===================================================================
--- /trunk/ippScripts/scripts/detrend_resid.pl	(revision 13936)
+++ /trunk/ippScripts/scripts/detrend_resid.pl	(revision 13937)
@@ -34,5 +34,5 @@
 
 my ($det_id, $iter, $exp_tag, $class_id, $det_type, $detrend,
-        $input_uri, $camera, $mode, $dbname, $workdir, $no_update, $no_op);
+        $input_uri, $camera, $mode, $dbname, $workdir, $reduction, $no_update, $no_op);
 GetOptions(
     'det_id|d=s'        => \$det_id,
@@ -47,4 +47,5 @@
     'dbname|d=s'        => \$dbname, # Database name
     'workdir|w=s'       => \$workdir,	# Working directory, for output files
+    'reduction=s'       => \$reduction,	# Reduction class
     'no-update'         => \$no_update,
     'no-op'             => \$no_op,
@@ -67,25 +68,14 @@
 $ipprc->define_camera($camera);
 
-# Recipes to use, as a function of the detrend type
-use constant RECIPES => {
-    'master' => {		# We're creating a master --- already processed the input
-	'bias'     => 'PPIMAGE_B',	# Bias only
-	'dark'     => 'PPIMAGE_D',	# Dark only
-	'shutter'  => 'PPIMAGE_S',	# Shutter only
-	'flat'     => 'PPIMAGE_F',	# Flat-field only
-	'domeflat' => 'PPIMAGE_F',	# Flat-field only
-	'skyflat'  => 'PPIMAGE_F',	# Flat-field only
-	'fringe'   => 'PPIMAGE_R',	# Fringe only
-    },
-    'verify' => {		# We're checking the master --- input is not already processed
-	'bias'     => 'PPIMAGE_OB',	# Bias only
-	'dark'     => 'PPIMAGE_OBD',	# Dark only
-	'shutter'  => 'PPIMAGE_OBDS',	# Shutter only
-	'flat'     => 'PPIMAGE_OBDSF',	# Flat-field only
-	'domeflat' => 'PPIMAGE_OBDSF',	# Flat-field only
-	'skyflat'  => 'PPIMAGE_OBDSF',	# Flat-field only
-	'fringe'   => 'PPIMAGE_OBDSFR',	# Fringe only
-    },
-};
+$reduction = 'DETREND' unless defined $reduction;
+my $recipe;			# Name of recipe to use
+if ($mode eq 'master') {
+    $recipe = $det_type . '_RESID';
+} elsif ($mode eq 'verify') {
+    $recipe = $det_type . '_VERIFY';
+} else {
+    &my_die("Unrecognised mode: $mode", $det_id, $iter, $exp_tag, $class_id, $PS_EXIT_PROG_ERROR);
+}
+$recipe = $ipprc->reduction($reduction, $recipe);
 
 # Flags to specify the particular detrend to use
@@ -113,9 +103,4 @@
 $ppImage .= " -dbname $dbname" if defined $dbname;
 
-# Recipe to use in processing
-&my_die("Unrecognised mode: $mode", $det_id, $iter, $exp_tag, $class_id, $PS_EXIT_PROG_ERROR) unless defined RECIPES->{$mode};
-my $recipe = RECIPES->{$mode}->{lc($det_type)};
-&my_die("Unrecognised detrend type: $det_type", $det_id, $iter, $exp_tag, $class_id, $PS_EXIT_PROG_ERROR) unless defined $recipe;
-
 $workdir = caturi( $workdir, "$camera.$det_type.$det_id" ) if defined $workdir;
 
@@ -183,6 +168,6 @@
 my $bg_mean_stdev = ($stats->bg_mean_stdev() or 'NAN');
 my $bin_stdev	  = ($binnedStats->bg_stdev() or 'NAN');
-my $fringe_0 	  = (${$stats->fringe()[0]} or 'NAN');
-my $fringe_1 	  = (${$stats->fringe_err()[0]} or 'NAN');
+my $fringe_0 	  = (${$stats->fringe()}[0] or 'NAN');
+my $fringe_1 	  = (${$stats->fringe_err()}[0] or 'NAN');
 my $fringe_2 	  = 'NAN';
 
Index: /trunk/ippScripts/scripts/detrend_stack.pl
===================================================================
--- /trunk/ippScripts/scripts/detrend_stack.pl	(revision 13936)
+++ /trunk/ippScripts/scripts/detrend_stack.pl	(revision 13937)
@@ -33,5 +33,5 @@
 use Pod::Usage qw( pod2usage );
 
-my ($det_id, $iter, $class_id, $det_type, $camera, $dbname, $workdir, $no_update, $no_op, $quiet);
+my ($det_id, $iter, $class_id, $det_type, $camera, $dbname, $workdir, $reduction, $no_update, $no_op, $quiet);
 GetOptions(
     'det_id|d=s'        => \$det_id,
@@ -42,4 +42,5 @@
     'dbname|d=s'        => \$dbname, # Database name
     'workdir|w=s'       => \$workdir,	# Working directory, for output files
+    'reduction=s'       => \$reduction,	# Reduction class for processing
     'no-update'         => \$no_update,
     'no-op'             => \$no_op,
@@ -58,14 +59,9 @@
 if (defined $quiet) { $verbose = 0; }
 
+$ipprc->define_camera($camera);
+
 # Recipes to use as a function of detrend type
-use constant RECIPES => {
-    'bias' => 'PPMERGE_BIAS',
-    'dark' => 'PPMERGE_DARK',
-    'shutter' => 'PPMERGE_SHUTTER',
-    'flat' => 'PPMERGE_FLAT',
-    'domeflat' => 'PPMERGE_FLAT',
-    'skyflat' => 'PPMERGE_FLAT',
-    'fringe' => 'PPMERGE_FRINGE',
-    };
+$reduction = "DETREND" unless defined $reduction;
+my $recipe = $ipprc->reduction($reduction, $det_type . '_STACK'); # Recipe name to use
 
 # Look for programs we need
@@ -77,7 +73,4 @@
     exit($PS_EXIT_CONFIG_ERROR); 
 }
-
-my $recipe = RECIPES()->{lc($det_type)}; # Recipe to use in stacking
-&my_die("Unrecognised detrend type: $det_type", $det_id, $iter, $class_id, $PS_EXIT_PROG_ERROR) unless defined $recipe;
 
 my $mdcParser = PS::IPP::Metadata::Config->new;	# Parser for metadata config files
Index: /trunk/ippScripts/scripts/ipp_serial_chip.pl
===================================================================
--- /trunk/ippScripts/scripts/ipp_serial_chip.pl	(revision 13936)
+++ /trunk/ippScripts/scripts/ipp_serial_chip.pl	(revision 13937)
@@ -54,6 +54,8 @@
     my $class_id = $item->{class_id};
     my $uri = $item->{uri};
+    my $reduction = $item->{reduction};
     
     my $command = "$chip --chip_id $chip_id --exp_id $exp_id --class_id $class_id --uri $uri --dbname $dbname --camera $camera";
+    $command .= " --reduction $reduction" if defined $reduction;
     $command .= " --no-op" if defined $no_op;
     $command .= " --no-update" if defined $no_update;
Index: /trunk/ippScripts/scripts/ipp_serial_detrend.pl
===================================================================
--- /trunk/ippScripts/scripts/ipp_serial_detrend.pl	(revision 13936)
+++ /trunk/ippScripts/scripts/ipp_serial_detrend.pl	(revision 13937)
@@ -65,6 +65,8 @@
 		my $camera = $item->{camera};
 		my $workdir = $item->{workdir};
-		
+		my $reduction = $item->{reduction};
+
 		my $command = "$detrend_process_imfile --det_id $det_id --exp_tag $exp_tag --class_id $class_id --det_type $det_type --input_uri $uri --camera $camera --dbname $dbname";
+		$command .= " --reduction $reduction" if defined $reduction;
 		$command .= " --workdir $workdir" if defined $workdir;
 		my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
@@ -119,6 +121,8 @@
 	my $camera = $item->{camera};
 	my $workdir = $item->{workdir};
+	my $reduction = $item->{reduction};
 
 	my $command = "$detrend_stack --det_id $det_id --iteration $iteration --class_id $class_id --det_type $det_type --camera $camera --dbname $dbname";
+	$command .= " --reduction $reduction" if defined $reduction;
 	$command .= " --workdir $workdir" if defined $workdir;
     	my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
@@ -235,6 +239,8 @@
 		my $mode = $item->{mode};
 		my $workdir = $item->{workdir};
+		my $reduction = $item->{reduction};
 
 		my $command = "$detrend_resid --det_id $det_id --iteration $iteration --exp_tag $exp_tag --class_id $class_id --det_type $det_type --camera $camera --input_uri $uri --mode $mode --dbname $dbname";
+		$command .= " --reduction $reduction" if defined $reduction;
 		$command .= " --detrend $detrend" if defined $detrend;
 		$command .= " --workdir $workdir" if defined $workdir;
Index: /trunk/ippTasks/chip.pro
===================================================================
--- /trunk/ippTasks/chip.pro	(revision 13936)
+++ /trunk/ippTasks/chip.pro	(revision 13937)
@@ -124,4 +124,5 @@
     book getword chipPendingImfile $pageName uri -var URI
     book getword chipPendingImfile $pageName dbname -var DBNAME
+    book getword chipPendingImfile $pageName reduction -var REDUCTION
 
     # specify choice of remote host
@@ -149,4 +150,7 @@
       $run = $run --workdir $WORKDIR
     end
+    if ("$REDUCTION" != "NULL")
+      $run = $run --reduction $REDUCTION
+    end
     add_standard_args run
 
Index: /trunk/ippTasks/detrend.process.pro
===================================================================
--- /trunk/ippTasks/detrend.process.pro	(revision 13936)
+++ /trunk/ippTasks/detrend.process.pro	(revision 13937)
@@ -144,4 +144,5 @@
     book getword detPendingProcessedImfile $pageName workdir  -var WORKDIR
     book getword detPendingProcessedImfile $pageName dbname   -var DBNAME
+    book getword detPendingProcessedImfile $pageName reduction -var REDUCTION
 
     # specify choice of remote host:
@@ -172,4 +173,7 @@
     if ("$WORKDIR" != "NULL")
       $run = $run --workdir $WORKDIR
+    end
+    if ("$REDUCTION" != "NULL")
+      $run = $run --reduction $REDUCTION
     end
     add_standard_args run
Index: /trunk/ippTasks/detrend.resid.pro
===================================================================
--- /trunk/ippTasks/detrend.resid.pro	(revision 13936)
+++ /trunk/ippTasks/detrend.resid.pro	(revision 13937)
@@ -144,4 +144,5 @@
     book getword detPendingResidImfile $pageName workdir   -var WORKDIR
     book getword detPendingResidImfile $pageName dbname    -var DBNAME
+    book getword detPendingResidImfile $pageName reduction -var REDUCTION
 
     # specify choice of remote host:
@@ -172,4 +173,7 @@
     if ("$WORKDIR" != "NULL")
       $run = $run --workdir $WORKDIR
+    end
+    if ("$REDUCTION" != "NULL")
+      $run = $run --reduction $REDUCTION
     end
     add_standard_args run
Index: /trunk/ippTasks/detrend.stack.pro
===================================================================
--- /trunk/ippTasks/detrend.stack.pro	(revision 13936)
+++ /trunk/ippTasks/detrend.stack.pro	(revision 13937)
@@ -125,4 +125,5 @@
     book getword detPendingStackedImfile $pageName workdir   -var WORKDIR
     book getword detPendingStackedImfile $pageName dbname    -var DBNAME
+    book getword detPendingStackedImfile $pageName reduction -var REDUCTION
 
     # specify choice of remote host:
@@ -156,4 +157,7 @@
       $run = $run --workdir $WORKDIR
     end
+    if ("$REDUCTION" != "NULL")
+      $run = $run --reduction $REDUCTION
+    end
     add_standard_args run
 
Index: /trunk/ippTools/configure.ac
===================================================================
--- /trunk/ippTools/configure.ac	(revision 13936)
+++ /trunk/ippTools/configure.ac	(revision 13937)
@@ -1,5 +1,5 @@
 AC_PREREQ(2.59)
 
-AC_INIT([ipptools], [1.1.22], [ipp-support@ifa.hawaii.edu])
+AC_INIT([ipptools], [1.1.23], [ipp-support@ifa.hawaii.edu])
 AC_CONFIG_SRCDIR([autogen.sh])
 
@@ -18,5 +18,5 @@
 PKG_CHECK_MODULES([PSLIB], [pslib >= 1.1.0])
 PKG_CHECK_MODULES([PSMODULES], [psmodules >= 1.1.0])
-PKG_CHECK_MODULES([IPPDB], [ippdb >= 1.1.22]) 
+PKG_CHECK_MODULES([IPPDB], [ippdb >= 1.1.23]) 
 
 PXTOOLS_CFLAGS="${PSLIB_CFLAGS=} ${PSMODULES_CFLAGS=} ${IPPDB_CFLAGS=}"
Index: /trunk/ippTools/src/camtool.c
===================================================================
--- /trunk/ippTools/src/camtool.c	(revision 13936)
+++ /trunk/ippTools/src/camtool.c	(revision 13937)
@@ -184,7 +184,7 @@
     }
 
-    psString recipe = psMetadataLookupStr(&status, config->args, "-set_recipe");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -set_recipe");
+    psString reduction = psMetadataLookupStr(&status, config->args, "-set_reduction");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -set_reduction");
         return false;
     }
@@ -237,5 +237,5 @@
 
     // would could do this "all in the database" if we didn't want the option
-    // of changing the label/recipe/expgroup/dvodb/etc.  So we're pulling the
+    // of changing the label/reduction/expgroup/dvodb/etc.  So we're pulling the
     // data out so we have the option of changing these values or leaving the
     // old values in place (i.e., passing the values through).
@@ -257,5 +257,5 @@
                     workdir     ? workdir   : row->workdir,
                     label       ? label     : row->label,
-                    recipe      ? recipe    : row->recipe,
+                    reduction      ? reduction    : row->reduction,
                     expgroup    ? expgroup  : row->expgroup,
                     dvodb       ? dvodb     : row->dvodb
@@ -617,5 +617,5 @@
         pendingRow->workdir,
         pendingRow->label,
-        pendingRow->recipe,
+        pendingRow->reduction,
         pendingRow->expgroup,
         pendingRow->dvodb,
@@ -628,10 +628,10 @@
         zp_mean,
         zp_stdev,
-	fwhm,
-	fwhm_range,
-	n_stars,
-	n_extended,
-	n_cr,
-	n_astrom,
+        fwhm,
+        fwhm_range,
+        n_stars,
+        n_extended,
+        n_cr,
+        n_astrom,
         path_base,
         code
Index: /trunk/ippTools/src/camtoolConfig.c
===================================================================
--- /trunk/ippTools/src/camtoolConfig.c	(revision 13936)
+++ /trunk/ippTools/src/camtoolConfig.c	(revision 13937)
@@ -96,6 +96,6 @@
     psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-set_label",  0,
             "define label", NULL);
-    psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-set_recipe",  0,
-            "define recipe", NULL);
+    psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-set_reduction",  0,
+            "define reduction class", NULL);
     psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-set_expgroup",  0,
             "define exposure group", NULL);
Index: /trunk/ippTools/src/chiptool.c
===================================================================
--- /trunk/ippTools/src/chiptool.c	(revision 13936)
+++ /trunk/ippTools/src/chiptool.c	(revision 13937)
@@ -173,7 +173,7 @@
     }
 
-    psString recipe = psMetadataLookupStr(&status, config->args, "-set_recipe");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -set_recipe");
+    psString reduction = psMetadataLookupStr(&status, config->args, "-set_reduction");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -set_reduction");
         return false;
     }
@@ -243,5 +243,5 @@
 
         // queue the exp
-        if (!chipQueueExpTag(config, exp_tag, workdir, label, recipe, expgroup, dvodb)) {
+        if (!chipQueueExpTag(config, exp_tag, workdir, label, reduction, expgroup, dvodb)) {
             if (!psDBRollback(config->dbh)) {
                 psError(PS_ERR_UNKNOWN, false, "database error");
@@ -804,5 +804,5 @@
                     processedExp->workdir,
                     processedExp->label,
-                    processedExp->recipe,
+                    processedExp->reduction,
                     processedExp->expgroup,
                     processedExp->dvodb
@@ -999,5 +999,5 @@
         pendingExp->workdir,
         pendingExp->label,
-        pendingExp->recipe,
+        pendingExp->reduction,
         pendingExp->expgroup,
         pendingExp->dvodb
Index: /trunk/ippTools/src/chiptoolConfig.c
===================================================================
--- /trunk/ippTools/src/chiptoolConfig.c	(revision 13936)
+++ /trunk/ippTools/src/chiptoolConfig.c	(revision 13937)
@@ -94,6 +94,6 @@
     psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-set_label",  0,
             "define label", NULL);
-    psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-set_recipe",  0,
-            "define recipe", NULL);
+    psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-set_reduction",  0,
+            "define reduction class", NULL);
     psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-set_expgroup",  0,
             "define exposure group", NULL);
@@ -115,5 +115,5 @@
             "search by camera of interest", NULL);
     psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-filter",  0,
-            "search by filter of interest", NULL); 
+            "search by filter of interest", NULL);
     psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-uri",  0,
             "search by URL", NULL);
@@ -122,5 +122,5 @@
     psMetadataAddBool(pendingimfileArgs, PS_LIST_TAIL, "-simple",  0,
             "use the simple output format", false);
- 
+
     // -addprocessedimfile
     psMetadata *addprocessedimfileArgs = psMetadataAlloc();
@@ -188,5 +188,5 @@
             "define camera of interest", NULL);
     psMetadataAddStr(processedimfileArgs, PS_LIST_TAIL, "-filter",  0,
-            "define filter of interest", NULL); 
+            "define filter of interest", NULL);
     psMetadataAddStr(processedimfileArgs, PS_LIST_TAIL, "-uri",  0,
             "define URL", NULL);
@@ -226,10 +226,10 @@
     psMetadataAddStr(blockArgs, PS_LIST_TAIL, "-label",  0,
             "name of a label to mask out (required)", NULL);
-    
+
     // -masked
     psMetadata *maskedArgs = psMetadataAlloc();
     psMetadataAddBool(maskedArgs, PS_LIST_TAIL, "-simple",  0,
             "use the simple output format", false);
-    
+
     // -unblock
     psMetadata *unblockArgs = psMetadataAlloc();
Index: /trunk/ippTools/src/dettool.c
===================================================================
--- /trunk/ippTools/src/dettool.c	(revision 13936)
+++ /trunk/ippTools/src/dettool.c	(revision 13937)
@@ -449,4 +449,10 @@
     }
 
+    psString reduction = psMetadataLookupStr(&status, config->args, "-reduction");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -reduction");
+        return false;
+    }
+
     psString label = psMetadataLookupStr(&status, config->args, "-label");
     if (!status) {
@@ -528,32 +534,33 @@
     // XXX det_id
     detRunInsert(config->dbh,
-            0,
-            0,
-            det_type,
-            mode,
-            "run",
-            filelevel,
-            workdir,
-            camera,
-            telescope,
-            exp_type,
-            filter,
-            airmass_min,
-            airmass_max,
-            exp_time_min,
-            exp_time_max,
-            ccd_temp_min,
-            ccd_temp_max,
-            posang_min,
-            posang_max,
-            registered,
-            time_begin,
-            time_end,
-            use_begin,
-            use_end,
-	    solang_min,
-            solang_max,
-            label,
-            0       // parent
+                 0,
+                 0,
+                 det_type,
+                 mode,
+                 "run",
+                 filelevel,
+                 workdir,
+                 camera,
+                 telescope,
+                 exp_type,
+                 reduction,
+                 filter,
+                 airmass_min,
+                 airmass_max,
+                 exp_time_min,
+                 exp_time_max,
+                 ccd_temp_min,
+                 ccd_temp_max,
+                 posang_min,
+                 posang_max,
+                 registered,
+                 time_begin,
+                 time_end,
+                 use_begin,
+                 use_end,
+                 solang_min,
+                 solang_max,
+                 label,
+                 0       // parent
         );
     psFree(registered);
@@ -1172,4 +1179,10 @@
     }
 
+    psString reduction = psMetadataLookupStr(&status, config->args, "-reduction");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -reduction");
+        return false;
+    }
+
     psString label = psMetadataLookupStr(&status, config->args, "-label");
     if (!status) {
@@ -1251,32 +1264,33 @@
     // XXX det_id
     detRunInsert(config->dbh,
-            0,      // det_id
-            0,      // iteration
-            det_type,
-            mode,
-            "run",  // state
-            filelevel,
-            workdir,
-            camera,
-            telescope,
-            "NA",
-            filter,
-            airmass_min,
-            airmass_max,
-            exp_time_min,
-            exp_time_max,
-            ccd_temp_min,
-            ccd_temp_max,
-            posang_min,
-            posang_max,
-            registered,
-            time_begin,
-            time_end,
-            use_begin,
-            use_end,
-	    solang_min,
-            solang_max,
-            label,
-            0       // parent
+                 0,      // det_id
+                 0,      // iteration
+                 det_type,
+                 mode,
+                 "run",  // state
+                 filelevel,
+                 workdir,
+                 camera,
+                 telescope,
+                 "NA",
+                 reduction,
+                 filter,
+                 airmass_min,
+                 airmass_max,
+                 exp_time_min,
+                 exp_time_max,
+                 ccd_temp_min,
+                 ccd_temp_max,
+                 posang_min,
+                 posang_max,
+                 registered,
+                 time_begin,
+                 time_end,
+                 use_begin,
+                 use_end,
+                 solang_min,
+                 solang_max,
+                 label,
+                 0       // parent
         );
     psFree(registered);
@@ -1671,4 +1685,14 @@
             psFree(use_end);
         }
+    }
+
+    psString reduction = psMetadataLookupStr(&status, config->args, "-set_reduction");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -set_reduction");
+        return false;
+    }
+    if (reduction) {
+        psFree(detRun->reduction);
+        detRun->reduction = psStringCopy(reduction);
     }
 
@@ -2115,4 +2139,5 @@
             "   detRun.det_type,"
             "   detRun.workdir,"
+            "   detRun.reduction,"
             "   rawImfile.*,"
             "   rawExp.camera"
@@ -2862,4 +2887,5 @@
         "    detRun.det_type,\n"
         "    detRun.workdir,\n"
+        "    detRun.reduction,\n"
         "    detProcessedImfile.class_id,\n"
         "    rawExp.camera\n"
@@ -2987,12 +3013,12 @@
     // add the two required restrictions: detRun.state and detRun.mode
     if ((value = psMetadataLookupStr(&status, config->args, "-select_state"))) {
-	psStringAppend(&query, " detRun.state = '%s'", value);
+        psStringAppend(&query, " detRun.state = '%s'", value);
     } else {
-	psStringAppend(&query, " detRun.state = 'run'");
+        psStringAppend(&query, " detRun.state = 'run'");
     }
     if ((value = psMetadataLookupStr(&status, config->args, "-select_mode"))) {
-	psStringAppend(&query, " AND detRun.mode = '%s'", value);
+        psStringAppend(&query, " AND detRun.mode = '%s'", value);
     } else {
-	psStringAppend(&query, " AND detRun.mode = 'master'");
+        psStringAppend(&query, " AND detRun.mode = 'master'");
     }
 
@@ -4407,4 +4433,5 @@
         "   detRun.mode,\n"
         "   detRun.workdir,\n"
+        "   detRun.reduction,\n"
         "   detProcessedImfile.exp_tag,\n"
         "   detProcessedImfile.class_id,\n"
@@ -4444,4 +4471,5 @@
         "   detRun.mode,\n"
         "   detRun.workdir,\n"
+        "   detRun.reduction,\n"
         "   rawImfile.exp_tag,\n"
         "   rawImfile.class_id,\n"
@@ -6774,33 +6802,34 @@
 
     if (!detRunInsert(config->dbh,
-            0,          // det_id
-            0,          // the iteration is fixed at 0
-            det_type,
-            mode,
-            "reg",      // state
-            filelevel,
-            workdir,
-            camera,
-            telescope,
-            exp_type,
-            filter,
-            airmass_min,
-            airmass_max,
-            exp_time_min,
-            exp_time_max,
-            ccd_temp_min,
-            ccd_temp_max,
-            posang_min,
-            posang_max,
-            registered,
-            time_begin,
-            time_end,
-            use_begin,
-            use_end,
-            solang_min,
-            solang_max,
-            label,      // label
-            parent ? (psS64)atoll(parent) : 0
-    )) {
+                      0,          // det_id
+                      0,          // the iteration is fixed at 0
+                      det_type,
+                      mode,
+                      "reg",      // state
+                      filelevel,
+                      workdir,
+                      camera,
+                      telescope,
+                      exp_type,
+                      NULL,
+                      filter,
+                      airmass_min,
+                      airmass_max,
+                      exp_time_min,
+                      exp_time_max,
+                      ccd_temp_min,
+                      ccd_temp_max,
+                      posang_min,
+                      posang_max,
+                      registered,
+                      time_begin,
+                      time_end,
+                      use_begin,
+                      use_end,
+                      solang_min,
+                      solang_max,
+                      label,      // label
+                      parent ? (psS64)atoll(parent) : 0
+            )) {
         psError(PS_ERR_UNKNOWN, false, "database error");
         // rollback
Index: /trunk/ippTools/src/dettoolConfig.c
===================================================================
--- /trunk/ippTools/src/dettoolConfig.c	(revision 13936)
+++ /trunk/ippTools/src/dettoolConfig.c	(revision 13937)
@@ -115,4 +115,6 @@
     psMetadataAddStr(definebytagArgs, PS_LIST_TAIL, "-use_end",  0,
             "end of detrend run applicable peroid", NULL);
+    psMetadataAddStr(definebytagArgs, PS_LIST_TAIL, "-reduction",  0,
+            "define reduction class for processing", NULL);
     psMetadataAddStr(definebytagArgs, PS_LIST_TAIL, "-label",  0,
             "define detrun label", NULL);
@@ -204,4 +206,6 @@
     psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-pretend",  0,
             "print the exposures that would be included in the detrend run and exit", false);
+    psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-reduction",  0,
+            "define reduction class for processing", NULL);
     psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-label",  0,
             "define detrun label", NULL);
@@ -259,4 +263,6 @@
     psMetadataAddStr(definebydetrunArgs, PS_LIST_TAIL, "-filter_input_end", 0,
             "filter input detrun exp to be in this peroid", NULL);
+    psMetadataAddStr(definebydetrunArgs, PS_LIST_TAIL, "-set_reduction",  0,
+            "define reduction class for processing", NULL);
     psMetadataAddStr(definebydetrunArgs, PS_LIST_TAIL, "-set_label",  0,
             "define detrun label", NULL);
Index: /trunk/ippconfig/megacam/camera.config
===================================================================
--- /trunk/ippconfig/megacam/camera.config	(revision 13936)
+++ /trunk/ippconfig/megacam/camera.config	(revision 13937)
@@ -113,4 +113,32 @@
 END
 
+REDUCTION	METADATA
+	DETREND		METADATA
+		BIAS_PROCESS	STR	PPIMAGE_O
+		BIAS_RESID	STR	PPIMAGE_B
+		BIAS_VERIFY	STR	PPIMAGE_OB
+		DARK_PROCESS	STR	PPIMAGE_OB
+		DARK_RESID	STR	PPIMAGE_D
+		DARK_VERIFY	STR	PPIMAGE_OBD
+		SHUTTER_PROCESS	STR	PPIMAGE_OBD
+		SHUTTER_RESID	STR	PPIMAGE_S
+		SHUTTER_VERIFY	STR	PPIMAGE_OBDS
+		FLAT_PROCESS	STR	PPIMAGE_OBDS
+		FLAT_RESID	STR	PPIMAGE_F
+		FLAT_VERIFY	STR	PPIMAGE_OBDSF
+		FRINGE_PROCESS	STR	PPIMAGE_OBDSF
+		FRINGE_RESID	STR	PPIMAGE_R
+		FRINGE_VERIFY	STR	PPIMAGE_OBDSFR
+	END
+
+	RAW		METADATA
+		CHIP		STR	PPIMAGE_OBDSFRA
+	END
+
+	PROCESSED	METADATA
+		CHIP		STR	PPIMAGE_PA
+	END
+END
+
 FILERULES METADATA
    ### Redirections
Index: /trunk/ippconfig/simtest/camera.config
===================================================================
--- /trunk/ippconfig/simtest/camera.config	(revision 13936)
+++ /trunk/ippconfig/simtest/camera.config	(revision 13937)
@@ -45,4 +45,42 @@
 	PSASTRO		STR	simtest/psastro.config	# psastro details
 	REJECTIONS	STR	simtest/rejections.config # Rejection for detrend creation
+END
+
+REDUCTION	METADATA
+	# Detrend processing
+	DETREND		METADATA
+		BIAS_PROCESS	STR	PPIMAGE_O
+		BIAS_RESID	STR	PPIMAGE_B
+		BIAS_VERIFY	STR	PPIMAGE_OB
+		BIAS_STACK	STR	PPMERGE_BIAS
+		DARK_PROCESS	STR	PPIMAGE_OB
+		DARK_RESID	STR	PPIMAGE_D
+		DARK_VERIFY	STR	PPIMAGE_OBD
+		DARK_STACK	STR	PPMERGE_DARK
+		SHUTTER_PROCESS	STR	PPIMAGE_OBD
+		SHUTTER_RESID	STR	PPIMAGE_S
+		SHUTTER_VERIFY	STR	PPIMAGE_OBDS
+		SHUTTER_STACK	STR	PPMERGE_SHUTTER
+		FLAT_PROCESS	STR	PPIMAGE_OBDS
+		FLAT_RESID	STR	PPIMAGE_F
+		FLAT_VERIFY	STR	PPIMAGE_OBDSF
+		FLAT_STACK	STR	PPMERGE_FLAT
+		FRINGE_PROCESS	STR	PPIMAGE_OBDSF
+		FRINGE_RESID	STR	PPIMAGE_R
+		FRINGE_VERIFY	STR	PPIMAGE_OBDSFR
+		FRINGE_STACK	STR	PPMERGE_FRINGE
+	END
+	# Processing raw data
+	DEFAULT		METADATA
+		CHIP		STR	PPIMAGE_OBDSFRA
+	END
+	NO_PHOTOM	METADATA
+		CHIP		STR	PPIMAGE_OBDSF
+	END
+	# Photometry and astrometry of data that's already processed
+	PROCESSED	METADATA
+		CHIP		STR	PPIMAGE_PA
+	END
+
 END
 
Index: /trunk/ippdb/configure.ac
===================================================================
--- /trunk/ippdb/configure.ac	(revision 13936)
+++ /trunk/ippdb/configure.ac	(revision 13937)
@@ -7,5 +7,5 @@
 AC_PREREQ(2.59)
 
-AC_INIT([ippdb], [1.1.22], [pan-starrs.ifa.hawaii.edu])
+AC_INIT([ippdb], [1.1.23], [pan-starrs.ifa.hawaii.edu])
 AC_CONFIG_SRCDIR([ippdb.pc.in])
 
Index: /trunk/ippdb/src/ippdb.c
===================================================================
--- /trunk/ippdb/src/ippdb.c	(revision 13936)
+++ /trunk/ippdb/src/ippdb.c	(revision 13937)
@@ -5541,5 +5541,5 @@
 static void chipPendingExpRowFree(chipPendingExpRow *object);
 
-chipPendingExpRow *chipPendingExpRowAlloc(psS64 chip_id, const char *exp_tag, psS64 guide_id, const char *workdir, const char *label, const char *recipe, const char *expgroup, const char *dvodb)
+chipPendingExpRow *chipPendingExpRowAlloc(psS64 chip_id, const char *exp_tag, psS64 guide_id, const char *workdir, const char *label, const char *reduction, const char *expgroup, const char *dvodb)
 {
     chipPendingExpRow *_object;
@@ -5553,5 +5553,5 @@
     _object->workdir = psStringCopy(workdir);
     _object->label = psStringCopy(label);
-    _object->recipe = psStringCopy(recipe);
+    _object->reduction = psStringCopy(reduction);
     _object->expgroup = psStringCopy(expgroup);
     _object->dvodb = psStringCopy(dvodb);
@@ -5565,5 +5565,5 @@
     psFree(object->workdir);
     psFree(object->label);
-    psFree(object->recipe);
+    psFree(object->reduction);
     psFree(object->expgroup);
     psFree(object->dvodb);
@@ -5598,6 +5598,6 @@
         return false;
     }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "recipe", PS_DATA_STRING, NULL, "64")) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item recipe");
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "reduction", PS_DATA_STRING, "Reduction class", "64")) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item reduction");
         psFree(md);
         return false;
@@ -5626,5 +5626,5 @@
 }
 
-bool chipPendingExpInsert(psDB * dbh, psS64 chip_id, const char *exp_tag, psS64 guide_id, const char *workdir, const char *label, const char *recipe, const char *expgroup, const char *dvodb)
+bool chipPendingExpInsert(psDB * dbh, psS64 chip_id, const char *exp_tag, psS64 guide_id, const char *workdir, const char *label, const char *reduction, const char *expgroup, const char *dvodb)
 {
     psMetadata *md = psMetadataAlloc();
@@ -5654,6 +5654,6 @@
         return false;
     }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "recipe", PS_DATA_STRING, NULL, recipe)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item recipe");
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "reduction", PS_DATA_STRING, NULL, reduction)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item reduction");
         psFree(md);
         return false;
@@ -5692,5 +5692,5 @@
 bool chipPendingExpInsertObject(psDB *dbh, chipPendingExpRow *object)
 {
-    return chipPendingExpInsert(dbh, object->chip_id, object->exp_tag, object->guide_id, object->workdir, object->label, object->recipe, object->expgroup, object->dvodb);
+    return chipPendingExpInsert(dbh, object->chip_id, object->exp_tag, object->guide_id, object->workdir, object->label, object->reduction, object->expgroup, object->dvodb);
 }
 
@@ -5790,6 +5790,6 @@
         return false;
     }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "recipe", PS_DATA_STRING, NULL, object->recipe)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item recipe");
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "reduction", PS_DATA_STRING, NULL, object->reduction)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item reduction");
         psFree(md);
         return false;
@@ -5839,7 +5839,7 @@
         return false;
     }
-    char* recipe = psMetadataLookupPtr(&status, md, "recipe");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item recipe");
+    char* reduction = psMetadataLookupPtr(&status, md, "reduction");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item reduction");
         return false;
     }
@@ -5855,5 +5855,5 @@
     }
 
-    return chipPendingExpRowAlloc(chip_id, exp_tag, guide_id, workdir, label, recipe, expgroup, dvodb);
+    return chipPendingExpRowAlloc(chip_id, exp_tag, guide_id, workdir, label, reduction, expgroup, dvodb);
 }
 psArray *chipPendingExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
@@ -6284,5 +6284,5 @@
 static void chipProcessedExpRowFree(chipProcessedExpRow *object);
 
-chipProcessedExpRow *chipProcessedExpRowAlloc(psS64 chip_id, const char *exp_tag, psS64 guide_id, const char *workdir, const char *label, const char *recipe, const char *expgroup, const char *dvodb)
+chipProcessedExpRow *chipProcessedExpRowAlloc(psS64 chip_id, const char *exp_tag, psS64 guide_id, const char *workdir, const char *label, const char *reduction, const char *expgroup, const char *dvodb)
 {
     chipProcessedExpRow *_object;
@@ -6296,5 +6296,5 @@
     _object->workdir = psStringCopy(workdir);
     _object->label = psStringCopy(label);
-    _object->recipe = psStringCopy(recipe);
+    _object->reduction = psStringCopy(reduction);
     _object->expgroup = psStringCopy(expgroup);
     _object->dvodb = psStringCopy(dvodb);
@@ -6308,5 +6308,5 @@
     psFree(object->workdir);
     psFree(object->label);
-    psFree(object->recipe);
+    psFree(object->reduction);
     psFree(object->expgroup);
     psFree(object->dvodb);
@@ -6341,6 +6341,6 @@
         return false;
     }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "recipe", PS_DATA_STRING, NULL, "64")) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item recipe");
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "reduction", PS_DATA_STRING, NULL, "64")) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item reduction");
         psFree(md);
         return false;
@@ -6369,5 +6369,5 @@
 }
 
-bool chipProcessedExpInsert(psDB * dbh, psS64 chip_id, const char *exp_tag, psS64 guide_id, const char *workdir, const char *label, const char *recipe, const char *expgroup, const char *dvodb)
+bool chipProcessedExpInsert(psDB * dbh, psS64 chip_id, const char *exp_tag, psS64 guide_id, const char *workdir, const char *label, const char *reduction, const char *expgroup, const char *dvodb)
 {
     psMetadata *md = psMetadataAlloc();
@@ -6397,6 +6397,6 @@
         return false;
     }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "recipe", PS_DATA_STRING, NULL, recipe)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item recipe");
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "reduction", PS_DATA_STRING, NULL, reduction)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item reduction");
         psFree(md);
         return false;
@@ -6435,5 +6435,5 @@
 bool chipProcessedExpInsertObject(psDB *dbh, chipProcessedExpRow *object)
 {
-    return chipProcessedExpInsert(dbh, object->chip_id, object->exp_tag, object->guide_id, object->workdir, object->label, object->recipe, object->expgroup, object->dvodb);
+    return chipProcessedExpInsert(dbh, object->chip_id, object->exp_tag, object->guide_id, object->workdir, object->label, object->reduction, object->expgroup, object->dvodb);
 }
 
@@ -6533,6 +6533,6 @@
         return false;
     }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "recipe", PS_DATA_STRING, NULL, object->recipe)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item recipe");
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "reduction", PS_DATA_STRING, NULL, object->reduction)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item reduction");
         psFree(md);
         return false;
@@ -6582,7 +6582,7 @@
         return false;
     }
-    char* recipe = psMetadataLookupPtr(&status, md, "recipe");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item recipe");
+    char* reduction = psMetadataLookupPtr(&status, md, "reduction");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item reduction");
         return false;
     }
@@ -6598,5 +6598,5 @@
     }
 
-    return chipProcessedExpRowAlloc(chip_id, exp_tag, guide_id, workdir, label, recipe, expgroup, dvodb);
+    return chipProcessedExpRowAlloc(chip_id, exp_tag, guide_id, workdir, label, reduction, expgroup, dvodb);
 }
 psArray *chipProcessedExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
@@ -7722,5 +7722,5 @@
 static void camPendingExpRowFree(camPendingExpRow *object);
 
-camPendingExpRow *camPendingExpRowAlloc(psS64 cam_id, psS64 chip_id, const char *workdir, const char *label, const char *recipe, const char *expgroup, const char *dvodb)
+camPendingExpRow *camPendingExpRowAlloc(psS64 cam_id, psS64 chip_id, const char *workdir, const char *label, const char *reduction, const char *expgroup, const char *dvodb)
 {
     camPendingExpRow *_object;
@@ -7733,5 +7733,5 @@
     _object->workdir = psStringCopy(workdir);
     _object->label = psStringCopy(label);
-    _object->recipe = psStringCopy(recipe);
+    _object->reduction = psStringCopy(reduction);
     _object->expgroup = psStringCopy(expgroup);
     _object->dvodb = psStringCopy(dvodb);
@@ -7744,5 +7744,5 @@
     psFree(object->workdir);
     psFree(object->label);
-    psFree(object->recipe);
+    psFree(object->reduction);
     psFree(object->expgroup);
     psFree(object->dvodb);
@@ -7772,6 +7772,6 @@
         return false;
     }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "recipe", PS_DATA_STRING, NULL, "64")) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item recipe");
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "reduction", PS_DATA_STRING, NULL, "64")) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item reduction");
         psFree(md);
         return false;
@@ -7800,5 +7800,5 @@
 }
 
-bool camPendingExpInsert(psDB * dbh, psS64 cam_id, psS64 chip_id, const char *workdir, const char *label, const char *recipe, const char *expgroup, const char *dvodb)
+bool camPendingExpInsert(psDB * dbh, psS64 cam_id, psS64 chip_id, const char *workdir, const char *label, const char *reduction, const char *expgroup, const char *dvodb)
 {
     psMetadata *md = psMetadataAlloc();
@@ -7823,6 +7823,6 @@
         return false;
     }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "recipe", PS_DATA_STRING, NULL, recipe)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item recipe");
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "reduction", PS_DATA_STRING, NULL, reduction)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item reduction");
         psFree(md);
         return false;
@@ -7861,5 +7861,5 @@
 bool camPendingExpInsertObject(psDB *dbh, camPendingExpRow *object)
 {
-    return camPendingExpInsert(dbh, object->cam_id, object->chip_id, object->workdir, object->label, object->recipe, object->expgroup, object->dvodb);
+    return camPendingExpInsert(dbh, object->cam_id, object->chip_id, object->workdir, object->label, object->reduction, object->expgroup, object->dvodb);
 }
 
@@ -7954,6 +7954,6 @@
         return false;
     }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "recipe", PS_DATA_STRING, NULL, object->recipe)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item recipe");
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "reduction", PS_DATA_STRING, NULL, object->reduction)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item reduction");
         psFree(md);
         return false;
@@ -7998,7 +7998,7 @@
         return false;
     }
-    char* recipe = psMetadataLookupPtr(&status, md, "recipe");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item recipe");
+    char* reduction = psMetadataLookupPtr(&status, md, "reduction");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item reduction");
         return false;
     }
@@ -8014,5 +8014,5 @@
     }
 
-    return camPendingExpRowAlloc(cam_id, chip_id, workdir, label, recipe, expgroup, dvodb);
+    return camPendingExpRowAlloc(cam_id, chip_id, workdir, label, reduction, expgroup, dvodb);
 }
 psArray *camPendingExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
@@ -8126,5 +8126,5 @@
 static void camProcessedExpRowFree(camProcessedExpRow *object);
 
-camProcessedExpRow *camProcessedExpRowAlloc(psS64 cam_id, psS64 chip_id, const char *workdir, const char *label, const char *recipe, const char *expgroup, const char *dvodb, const char *uri, psF32 bg, psF32 bg_stdev, psF32 bg_mean_stdev, psF32 sigma_ra, psF32 sigma_dec, psF32 zp_mean, psF32 zp_stdev, psF32 fwhm, psF32 fwhm_range, psS32 n_stars, psS32 n_extended, psS32 n_cr, psS32 n_astrom, const char *path_base, psS16 fault)
+camProcessedExpRow *camProcessedExpRowAlloc(psS64 cam_id, psS64 chip_id, const char *workdir, const char *label, const char *reduction, const char *expgroup, const char *dvodb, const char *uri, psF32 bg, psF32 bg_stdev, psF32 bg_mean_stdev, psF32 sigma_ra, psF32 sigma_dec, psF32 zp_mean, psF32 zp_stdev, psF32 fwhm, psF32 fwhm_range, psS32 n_stars, psS32 n_extended, psS32 n_cr, psS32 n_astrom, const char *path_base, psS16 fault)
 {
     camProcessedExpRow *_object;
@@ -8137,5 +8137,5 @@
     _object->workdir = psStringCopy(workdir);
     _object->label = psStringCopy(label);
-    _object->recipe = psStringCopy(recipe);
+    _object->reduction = psStringCopy(reduction);
     _object->expgroup = psStringCopy(expgroup);
     _object->dvodb = psStringCopy(dvodb);
@@ -8164,5 +8164,5 @@
     psFree(object->workdir);
     psFree(object->label);
-    psFree(object->recipe);
+    psFree(object->reduction);
     psFree(object->expgroup);
     psFree(object->dvodb);
@@ -8194,6 +8194,6 @@
         return false;
     }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "recipe", PS_DATA_STRING, NULL, "64")) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item recipe");
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "reduction", PS_DATA_STRING, NULL, "64")) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item reduction");
         psFree(md);
         return false;
@@ -8302,5 +8302,5 @@
 }
 
-bool camProcessedExpInsert(psDB * dbh, psS64 cam_id, psS64 chip_id, const char *workdir, const char *label, const char *recipe, const char *expgroup, const char *dvodb, const char *uri, psF32 bg, psF32 bg_stdev, psF32 bg_mean_stdev, psF32 sigma_ra, psF32 sigma_dec, psF32 zp_mean, psF32 zp_stdev, psF32 fwhm, psF32 fwhm_range, psS32 n_stars, psS32 n_extended, psS32 n_cr, psS32 n_astrom, const char *path_base, psS16 fault)
+bool camProcessedExpInsert(psDB * dbh, psS64 cam_id, psS64 chip_id, const char *workdir, const char *label, const char *reduction, const char *expgroup, const char *dvodb, const char *uri, psF32 bg, psF32 bg_stdev, psF32 bg_mean_stdev, psF32 sigma_ra, psF32 sigma_dec, psF32 zp_mean, psF32 zp_stdev, psF32 fwhm, psF32 fwhm_range, psS32 n_stars, psS32 n_extended, psS32 n_cr, psS32 n_astrom, const char *path_base, psS16 fault)
 {
     psMetadata *md = psMetadataAlloc();
@@ -8325,6 +8325,6 @@
         return false;
     }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "recipe", PS_DATA_STRING, NULL, recipe)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item recipe");
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "reduction", PS_DATA_STRING, NULL, reduction)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item reduction");
         psFree(md);
         return false;
@@ -8443,5 +8443,5 @@
 bool camProcessedExpInsertObject(psDB *dbh, camProcessedExpRow *object)
 {
-    return camProcessedExpInsert(dbh, object->cam_id, object->chip_id, object->workdir, object->label, object->recipe, object->expgroup, object->dvodb, object->uri, object->bg, object->bg_stdev, object->bg_mean_stdev, object->sigma_ra, object->sigma_dec, object->zp_mean, object->zp_stdev, object->fwhm, object->fwhm_range, object->n_stars, object->n_extended, object->n_cr, object->n_astrom, object->path_base, object->fault);
+    return camProcessedExpInsert(dbh, object->cam_id, object->chip_id, object->workdir, object->label, object->reduction, object->expgroup, object->dvodb, object->uri, object->bg, object->bg_stdev, object->bg_mean_stdev, object->sigma_ra, object->sigma_dec, object->zp_mean, object->zp_stdev, object->fwhm, object->fwhm_range, object->n_stars, object->n_extended, object->n_cr, object->n_astrom, object->path_base, object->fault);
 }
 
@@ -8536,6 +8536,6 @@
         return false;
     }
-    if (!psMetadataAdd(md, PS_LIST_TAIL, "recipe", PS_DATA_STRING, NULL, object->recipe)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item recipe");
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "reduction", PS_DATA_STRING, NULL, object->reduction)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item reduction");
         psFree(md);
         return false;
@@ -8660,7 +8660,7 @@
         return false;
     }
-    char* recipe = psMetadataLookupPtr(&status, md, "recipe");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item recipe");
+    char* reduction = psMetadataLookupPtr(&status, md, "reduction");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item reduction");
         return false;
     }
@@ -8756,5 +8756,5 @@
     }
 
-    return camProcessedExpRowAlloc(cam_id, chip_id, workdir, label, recipe, expgroup, dvodb, uri, bg, bg_stdev, bg_mean_stdev, sigma_ra, sigma_dec, zp_mean, zp_stdev, fwhm, fwhm_range, n_stars, n_extended, n_cr, n_astrom, path_base, fault);
+    return camProcessedExpRowAlloc(cam_id, chip_id, workdir, label, reduction, expgroup, dvodb, uri, bg, bg_stdev, bg_mean_stdev, sigma_ra, sigma_dec, zp_mean, zp_stdev, fwhm, fwhm_range, n_stars, n_extended, n_cr, n_astrom, path_base, fault);
 }
 psArray *camProcessedExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
@@ -12827,5 +12827,5 @@
 static void detRunRowFree(detRunRow *object);
 
-detRunRow *detRunRowAlloc(psS64 det_id, psS32 iteration, const char *det_type, const char *mode, const char *state, const char *filelevel, const char *workdir, const char *camera, const char *telescope, const char *exp_type, const char *filter, psF32 airmass_min, psF32 airmass_max, psF32 exp_time_min, psF32 exp_time_max, psF32 ccd_temp_min, psF32 ccd_temp_max, psF64 posang_min, psF64 posang_max, psTime* registered, psTime* time_begin, psTime* time_end, psTime* use_begin, psTime* use_end, psF32 solang_min, psF32 solang_max, const char *label, psS32 parent)
+detRunRow *detRunRowAlloc(psS64 det_id, psS32 iteration, const char *det_type, const char *mode, const char *state, const char *filelevel, const char *workdir, const char *camera, const char *telescope, const char *exp_type, const char *reduction, const char *filter, psF32 airmass_min, psF32 airmass_max, psF32 exp_time_min, psF32 exp_time_max, psF32 ccd_temp_min, psF32 ccd_temp_max, psF64 posang_min, psF64 posang_max, psTime* registered, psTime* time_begin, psTime* time_end, psTime* use_begin, psTime* use_end, psF32 solang_min, psF32 solang_max, const char *label, psS32 parent)
 {
     detRunRow       *_object;
@@ -12844,4 +12844,5 @@
     _object->telescope = psStringCopy(telescope);
     _object->exp_type = psStringCopy(exp_type);
+    _object->reduction = psStringCopy(reduction);
     _object->filter = psStringCopy(filter);
     _object->airmass_min = airmass_min;
@@ -12876,4 +12877,5 @@
     psFree(object->telescope);
     psFree(object->exp_type);
+    psFree(object->reduction);
     psFree(object->filter);
     psFree(object->registered);
@@ -12938,4 +12940,9 @@
         return false;
     }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "reduction", PS_DATA_STRING, "Reduction clas", "64")) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item reduction");
+        psFree(md);
+        return false;
+    }
     if (!psMetadataAdd(md, PS_LIST_TAIL, "filter", PS_DATA_STRING, NULL, "64")) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item filter");
@@ -13041,5 +13048,5 @@
 }
 
-bool detRunInsert(psDB * dbh, psS64 det_id, psS32 iteration, const char *det_type, const char *mode, const char *state, const char *filelevel, const char *workdir, const char *camera, const char *telescope, const char *exp_type, const char *filter, psF32 airmass_min, psF32 airmass_max, psF32 exp_time_min, psF32 exp_time_max, psF32 ccd_temp_min, psF32 ccd_temp_max, psF64 posang_min, psF64 posang_max, psTime* registered, psTime* time_begin, psTime* time_end, psTime* use_begin, psTime* use_end, psF32 solang_min, psF32 solang_max, const char *label, psS32 parent)
+bool detRunInsert(psDB * dbh, psS64 det_id, psS32 iteration, const char *det_type, const char *mode, const char *state, const char *filelevel, const char *workdir, const char *camera, const char *telescope, const char *exp_type, const char *reduction, const char *filter, psF32 airmass_min, psF32 airmass_max, psF32 exp_time_min, psF32 exp_time_max, psF32 ccd_temp_min, psF32 ccd_temp_max, psF64 posang_min, psF64 posang_max, psTime* registered, psTime* time_begin, psTime* time_end, psTime* use_begin, psTime* use_end, psF32 solang_min, psF32 solang_max, const char *label, psS32 parent)
 {
     psMetadata *md = psMetadataAlloc();
@@ -13091,4 +13098,9 @@
     if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_type", PS_DATA_STRING, NULL, exp_type)) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item exp_type");
+        psFree(md);
+        return false;
+    }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "reduction", PS_DATA_STRING, NULL, reduction)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item reduction");
         psFree(md);
         return false;
@@ -13207,5 +13219,5 @@
 bool detRunInsertObject(psDB *dbh, detRunRow *object)
 {
-    return detRunInsert(dbh, object->det_id, object->iteration, object->det_type, object->mode, object->state, object->filelevel, object->workdir, object->camera, object->telescope, object->exp_type, object->filter, object->airmass_min, object->airmass_max, object->exp_time_min, object->exp_time_max, object->ccd_temp_min, object->ccd_temp_max, object->posang_min, object->posang_max, object->registered, object->time_begin, object->time_end, object->use_begin, object->use_end, object->solang_min, object->solang_max, object->label, object->parent);
+    return detRunInsert(dbh, object->det_id, object->iteration, object->det_type, object->mode, object->state, object->filelevel, object->workdir, object->camera, object->telescope, object->exp_type, object->reduction, object->filter, object->airmass_min, object->airmass_max, object->exp_time_min, object->exp_time_max, object->ccd_temp_min, object->ccd_temp_max, object->posang_min, object->posang_max, object->registered, object->time_begin, object->time_end, object->use_begin, object->use_end, object->solang_min, object->solang_max, object->label, object->parent);
 }
 
@@ -13330,4 +13342,9 @@
         return false;
     }
+    if (!psMetadataAdd(md, PS_LIST_TAIL, "reduction", PS_DATA_STRING, NULL, object->reduction)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to add item reduction");
+        psFree(md);
+        return false;
+    }
     if (!psMetadataAdd(md, PS_LIST_TAIL, "filter", PS_DATA_STRING, NULL, object->filter)) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item filter");
@@ -13479,4 +13496,9 @@
         return false;
     }
+    char* reduction = psMetadataLookupPtr(&status, md, "reduction");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item reduction");
+        return false;
+    }
     char* filter = psMetadataLookupPtr(&status, md, "filter");
     if (!status) {
@@ -13570,5 +13592,5 @@
     }
 
-    return detRunRowAlloc(det_id, iteration, det_type, mode, state, filelevel, workdir, camera, telescope, exp_type, filter, airmass_min, airmass_max, exp_time_min, exp_time_max, ccd_temp_min, ccd_temp_max, posang_min, posang_max, registered, time_begin, time_end, use_begin, use_end, solang_min, solang_max, label, parent);
+    return detRunRowAlloc(det_id, iteration, det_type, mode, state, filelevel, workdir, camera, telescope, exp_type, reduction, filter, airmass_min, airmass_max, exp_time_min, exp_time_max, ccd_temp_min, ccd_temp_max, posang_min, posang_max, registered, time_begin, time_end, use_begin, use_end, solang_min, solang_max, label, parent);
 }
 psArray *detRunSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
Index: /trunk/ippdb/src/ippdb.h
===================================================================
--- /trunk/ippdb/src/ippdb.h	(revision 13936)
+++ /trunk/ippdb/src/ippdb.h	(revision 13937)
@@ -2755,5 +2755,5 @@
     char            *workdir;
     char            *label;
-    char            *recipe;
+    char            *reduction;
     char            *expgroup;
     char            *dvodb;
@@ -2771,5 +2771,5 @@
     const char      *workdir,
     const char      *label,
-    const char      *recipe,
+    const char      *reduction,
     const char      *expgroup,
     const char      *dvodb
@@ -2808,5 +2808,5 @@
     const char      *workdir,
     const char      *label,
-    const char      *recipe,
+    const char      *reduction,
     const char      *expgroup,
     const char      *dvodb
@@ -3172,5 +3172,5 @@
     char            *workdir;
     char            *label;
-    char            *recipe;
+    char            *reduction;
     char            *expgroup;
     char            *dvodb;
@@ -3188,5 +3188,5 @@
     const char      *workdir,
     const char      *label,
-    const char      *recipe,
+    const char      *reduction,
     const char      *expgroup,
     const char      *dvodb
@@ -3225,5 +3225,5 @@
     const char      *workdir,
     const char      *label,
-    const char      *recipe,
+    const char      *reduction,
     const char      *expgroup,
     const char      *dvodb
@@ -3843,5 +3843,5 @@
     char            *workdir;
     char            *label;
-    char            *recipe;
+    char            *reduction;
     char            *expgroup;
     char            *dvodb;
@@ -3858,5 +3858,5 @@
     const char      *workdir,
     const char      *label,
-    const char      *recipe,
+    const char      *reduction,
     const char      *expgroup,
     const char      *dvodb
@@ -3894,5 +3894,5 @@
     const char      *workdir,
     const char      *label,
-    const char      *recipe,
+    const char      *reduction,
     const char      *expgroup,
     const char      *dvodb
@@ -4056,5 +4056,5 @@
     char            *workdir;
     char            *label;
-    char            *recipe;
+    char            *reduction;
     char            *expgroup;
     char            *dvodb;
@@ -4087,5 +4087,5 @@
     const char      *workdir,
     const char      *label,
-    const char      *recipe,
+    const char      *reduction,
     const char      *expgroup,
     const char      *dvodb,
@@ -4139,5 +4139,5 @@
     const char      *workdir,
     const char      *label,
-    const char      *recipe,
+    const char      *reduction,
     const char      *expgroup,
     const char      *dvodb,
@@ -6600,4 +6600,5 @@
     char            *telescope;
     char            *exp_type;
+    char            *reduction;
     char            *filter;
     psF32           airmass_min;
@@ -6636,4 +6637,5 @@
     const char      *telescope,
     const char      *exp_type,
+    const char      *reduction,
     const char      *filter,
     psF32           airmass_min,
@@ -6693,4 +6695,5 @@
     const char      *telescope,
     const char      *exp_type,
+    const char      *reduction,
     const char      *filter,
     psF32           airmass_min,
Index: /trunk/ippdb/tests/alloc.c
===================================================================
--- /trunk/ippdb/tests/alloc.c	(revision 13936)
+++ /trunk/ippdb/tests/alloc.c	(revision 13937)
@@ -610,5 +610,5 @@
             exit(EXIT_FAILURE);
         }
-        if (strncmp(object->recipe, "a string", MAX_STRING_LENGTH)) {
+        if (strncmp(object->reduction, "a string", MAX_STRING_LENGTH)) {
             psFree(object);
             exit(EXIT_FAILURE);
@@ -680,5 +680,5 @@
             exit(EXIT_FAILURE);
         }
-        if (strncmp(object->recipe, "a string", MAX_STRING_LENGTH)) {
+        if (strncmp(object->reduction, "a string", MAX_STRING_LENGTH)) {
             psFree(object);
             exit(EXIT_FAILURE);
@@ -843,5 +843,5 @@
             exit(EXIT_FAILURE);
         }
-        if (strncmp(object->recipe, "a string", MAX_STRING_LENGTH)) {
+        if (strncmp(object->reduction, "a string", MAX_STRING_LENGTH)) {
             psFree(object);
             exit(EXIT_FAILURE);
@@ -884,5 +884,5 @@
             exit(EXIT_FAILURE);
         }
-        if (strncmp(object->recipe, "a string", MAX_STRING_LENGTH)) {
+        if (strncmp(object->reduction, "a string", MAX_STRING_LENGTH)) {
             psFree(object);
             exit(EXIT_FAILURE);
@@ -1327,5 +1327,5 @@
         detRunRow       *object;
 
-        object = detRunRowAlloc(-64, -32, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 64.64, 64.64, "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", 32.32, 32.32, "a string", -32    );
+        object = detRunRowAlloc(-64, -32, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 64.64, 64.64, "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", 32.32, 32.32, "a string", -32    );
 
         if (!object) {
@@ -1370,4 +1370,8 @@
         }
         if (strncmp(object->exp_type, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->reduction, "a string", MAX_STRING_LENGTH)) {
             psFree(object);
             exit(EXIT_FAILURE);
Index: /trunk/ippdb/tests/insert.c
===================================================================
--- /trunk/ippdb/tests/insert.c	(revision 13936)
+++ /trunk/ippdb/tests/insert.c	(revision 13937)
@@ -463,5 +463,5 @@
         }
 
-        if (!detRunInsert(dbh, -64, -32, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 64.64, 64.64, "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", 32.32, 32.32, "a string", -32)) {
+        if (!detRunInsert(dbh, -64, -32, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 64.64, 64.64, "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", 32.32, 32.32, "a string", -32)) {
             exit(EXIT_FAILURE);
         }
Index: /trunk/ippdb/tests/insertobject.c
===================================================================
--- /trunk/ippdb/tests/insertobject.c	(revision 13936)
+++ /trunk/ippdb/tests/insertobject.c	(revision 13937)
@@ -674,5 +674,5 @@
         }
 
-        object = detRunRowAlloc(-64, -32, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 64.64, 64.64, "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", 32.32, 32.32, "a string", -32);
+        object = detRunRowAlloc(-64, -32, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 64.64, 64.64, "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", 32.32, 32.32, "a string", -32);
         if (!object) {
             exit(EXIT_FAILURE);
Index: /trunk/ippdb/tests/metadatafromobject.c
===================================================================
--- /trunk/ippdb/tests/metadatafromobject.c	(revision 13936)
+++ /trunk/ippdb/tests/metadatafromobject.c	(revision 13937)
@@ -708,5 +708,5 @@
             exit(EXIT_FAILURE);
         }
-        if (strncmp(psMetadataLookupPtr(&status, md, "recipe"), "a string", MAX_STRING_LENGTH)) {
+        if (strncmp(psMetadataLookupPtr(&status, md, "reduction"), "a string", MAX_STRING_LENGTH)) {
             psFree(md);
             exit(EXIT_FAILURE);
@@ -791,5 +791,5 @@
             exit(EXIT_FAILURE);
         }
-        if (strncmp(psMetadataLookupPtr(&status, md, "recipe"), "a string", MAX_STRING_LENGTH)) {
+        if (strncmp(psMetadataLookupPtr(&status, md, "reduction"), "a string", MAX_STRING_LENGTH)) {
             psFree(md);
             exit(EXIT_FAILURE);
@@ -974,5 +974,5 @@
             exit(EXIT_FAILURE);
         }
-        if (strncmp(psMetadataLookupPtr(&status, md, "recipe"), "a string", MAX_STRING_LENGTH)) {
+        if (strncmp(psMetadataLookupPtr(&status, md, "reduction"), "a string", MAX_STRING_LENGTH)) {
             psFree(md);
             exit(EXIT_FAILURE);
@@ -1021,5 +1021,5 @@
             exit(EXIT_FAILURE);
         }
-        if (strncmp(psMetadataLookupPtr(&status, md, "recipe"), "a string", MAX_STRING_LENGTH)) {
+        if (strncmp(psMetadataLookupPtr(&status, md, "reduction"), "a string", MAX_STRING_LENGTH)) {
             psFree(md);
             exit(EXIT_FAILURE);
@@ -1538,5 +1538,5 @@
         bool            status;
 
-        object = detRunRowAlloc(-64, -32, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 64.64, 64.64, "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", 32.32, 32.32, "a string", -32);
+        object = detRunRowAlloc(-64, -32, "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", "a string", 32.32, 32.32, 32.32, 32.32, 32.32, 32.32, 64.64, 64.64, "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", "0001-01-01T00:00:00Z", 32.32, 32.32, "a string", -32);
         if (!object) {
             exit(EXIT_FAILURE);
@@ -1586,4 +1586,8 @@
         }
         if (strncmp(psMetadataLookupPtr(&status, md, "exp_type"), "a string", MAX_STRING_LENGTH)) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(psMetadataLookupPtr(&status, md, "reduction"), "a string", MAX_STRING_LENGTH)) {
             psFree(md);
             exit(EXIT_FAILURE);
Index: /trunk/ippdb/tests/objectfrommetadata.c
===================================================================
--- /trunk/ippdb/tests/objectfrommetadata.c	(revision 13936)
+++ /trunk/ippdb/tests/objectfrommetadata.c	(revision 13937)
@@ -1073,5 +1073,5 @@
             exit(EXIT_FAILURE);
         }
-        if (!psMetadataAddStr(md, PS_LIST_TAIL, "recipe", 0, NULL, "a string")) {
+        if (!psMetadataAddStr(md, PS_LIST_TAIL, "reduction", 0, NULL, "a string")) {
             psFree(md);
             exit(EXIT_FAILURE);
@@ -1112,5 +1112,5 @@
             exit(EXIT_FAILURE);
         }
-        if (strncmp(object->recipe, "a string", MAX_STRING_LENGTH)) {
+        if (strncmp(object->reduction, "a string", MAX_STRING_LENGTH)) {
             psFree(object);
             exit(EXIT_FAILURE);
@@ -1191,5 +1191,5 @@
             exit(EXIT_FAILURE);
         }
-        if (!psMetadataAddStr(md, PS_LIST_TAIL, "recipe", 0, NULL, "a string")) {
+        if (!psMetadataAddStr(md, PS_LIST_TAIL, "reduction", 0, NULL, "a string")) {
             psFree(md);
             exit(EXIT_FAILURE);
@@ -1230,5 +1230,5 @@
             exit(EXIT_FAILURE);
         }
-        if (strncmp(object->recipe, "a string", MAX_STRING_LENGTH)) {
+        if (strncmp(object->reduction, "a string", MAX_STRING_LENGTH)) {
             psFree(object);
             exit(EXIT_FAILURE);
@@ -1489,5 +1489,5 @@
             exit(EXIT_FAILURE);
         }
-        if (!psMetadataAddStr(md, PS_LIST_TAIL, "recipe", 0, NULL, "a string")) {
+        if (!psMetadataAddStr(md, PS_LIST_TAIL, "reduction", 0, NULL, "a string")) {
             psFree(md);
             exit(EXIT_FAILURE);
@@ -1524,5 +1524,5 @@
             exit(EXIT_FAILURE);
         }
-        if (strncmp(object->recipe, "a string", MAX_STRING_LENGTH)) {
+        if (strncmp(object->reduction, "a string", MAX_STRING_LENGTH)) {
             psFree(object);
             exit(EXIT_FAILURE);
@@ -1559,5 +1559,5 @@
             exit(EXIT_FAILURE);
         }
-        if (!psMetadataAddStr(md, PS_LIST_TAIL, "recipe", 0, NULL, "a string")) {
+        if (!psMetadataAddStr(md, PS_LIST_TAIL, "reduction", 0, NULL, "a string")) {
             psFree(md);
             exit(EXIT_FAILURE);
@@ -1657,5 +1657,5 @@
             exit(EXIT_FAILURE);
         }
-        if (strncmp(object->recipe, "a string", MAX_STRING_LENGTH)) {
+        if (strncmp(object->reduction, "a string", MAX_STRING_LENGTH)) {
             psFree(object);
             exit(EXIT_FAILURE);
@@ -2382,4 +2382,8 @@
             exit(EXIT_FAILURE);
         }
+        if (!psMetadataAddStr(md, PS_LIST_TAIL, "reduction", 0, NULL, "a string")) {
+            psFree(md);
+            exit(EXIT_FAILURE);
+        }
         if (!psMetadataAddStr(md, PS_LIST_TAIL, "filter", 0, NULL, "a string")) {
             psFree(md);
@@ -2494,4 +2498,8 @@
         }
         if (strncmp(object->exp_type, "a string", MAX_STRING_LENGTH)) {
+            psFree(object);
+            exit(EXIT_FAILURE);
+        }
+        if (strncmp(object->reduction, "a string", MAX_STRING_LENGTH)) {
             psFree(object);
             exit(EXIT_FAILURE);
