Index: trunk/ippScripts/scripts/diff_skycell.pl
===================================================================
--- trunk/ippScripts/scripts/diff_skycell.pl	(revision 13748)
+++ trunk/ippScripts/scripts/diff_skycell.pl	(revision 14239)
@@ -47,4 +47,12 @@
     -exitval => 3,
 	  ) unless defined $diff_id;
+
+my $STATS = 
+   [   
+       #          PPSTATS KEYWORD         STATISTIC          DIFFTOOL FLAG
+       { name => "ROBUST_MEDIAN",  type => "mean",  flag => "-bg",             dtype => "float" },
+       { name => "ROBUST_STDEV",   type => "rms",   flag => "-bg_stdev",       dtype => "float" },
+   ];
+my $stats = PS::IPP::Metadata::Stats->new($STATS); # Stats parser
 
 # Look for programs we need
@@ -141,5 +149,4 @@
 
 # Perform subtraction
-my $stats = PS::IPP::Metadata::Stats->new(); # Stats parser
 unless ($no_op) {
     my $command = "$ppSub $input $template $outputRoot";
@@ -171,8 +178,4 @@
 }
 
-# Add the processed file to the database
-my $bg = ($stats->bg_mean() or 'NAN');
-my $bg_stdev = ($stats->bg_stdev() or 'NAN');
-
 unless ($no_update) {
 
@@ -180,5 +183,5 @@
     {
 	my $command = "$difftool -adddiffskyfile -diff_id $diff_id -uri $outputName -path_base $outputRoot";
-	$command .= " -bg $bg -bg_stdev $bg_stdev";
+	$command .= $stats->cmdflags();
 	$command .= " -dbname $dbname" if defined $dbname;
 	
