Index: trunk/psphot/src/psphotSignificanceImage.c
===================================================================
--- trunk/psphot/src/psphotSignificanceImage.c	(revision 25383)
+++ trunk/psphot/src/psphotSignificanceImage.c	(revision 26894)
@@ -22,7 +22,8 @@
     }
 
+    // if we have already determined the PSF model, then we have a better idea how to smooth this image
     bool statusMajor, statusMinor;
-    float fwhmMajor = psMetadataLookupF32(&statusMajor, recipe, "FWHM_MAJ");
-    float fwhmMinor = psMetadataLookupF32(&statusMinor, recipe, "FWHM_MIN");
+    float fwhmMajor = psMetadataLookupF32(&statusMajor, readout->analysis, "FWHM_MAJ");
+    float fwhmMinor = psMetadataLookupF32(&statusMinor, readout->analysis, "FWHM_MIN");
     if (statusMajor && statusMinor) {
         // if we know the FHWM, use that to set the smoothing kernel (XXX allow an optional override?)
@@ -43,6 +44,5 @@
     }
     // record the actual smoothing sigma
-    psMetadataAddF32(recipe, PS_LIST_TAIL, "SIGMA_SMOOTH", PS_META_REPLACE, "Smoothing sigma for detections",
-                     SIGMA_SMTH);
+    psMetadataAddF32(readout->analysis, PS_LIST_TAIL, "SIGMA_SMOOTH", PS_META_REPLACE, "Smoothing sigma for detections", SIGMA_SMTH);
 
     // smooth the image, applying the mask as we go
@@ -59,6 +59,5 @@
     // effective per-pixel variance is maintained.
     psImage *smooth_wt = psImageCopy(NULL, readout->variance, PS_TYPE_F32);
-    psImageSmoothMask_Threaded(smooth_wt, smooth_wt, readout->mask, maskVal, SIGMA_SMTH * M_SQRT1_2,
-                      NSIGMA_SMTH, minGauss);
+    psImageSmoothMask_Threaded(smooth_wt, smooth_wt, readout->mask, maskVal, SIGMA_SMTH * M_SQRT1_2, NSIGMA_SMTH, minGauss);
     psLogMsg("psphot", PS_LOG_MINUTIA, "smooth variance: %f sec\n", psTimerMark("psphot.smooth"));
 
@@ -77,14 +76,11 @@
     // Calculate correction factor for the covariance produced by the (potentially multiple) smoothing
     psKernel *kernel = psImageSmoothKernel(SIGMA_SMTH, NSIGMA_SMTH); // Kernel used for smoothing
-    psKernel *covar = psImageCovarianceCalculate(kernel, readout->covariance); // Covariance matrix
+    float factor = 1.0 / psImageCovarianceCalculateFactor(kernel, readout->covariance);
     psFree(kernel);
-    float factor = 1.0 / psImageCovarianceFactor(covar);
-    psFree(covar);
 
     // record the effective area and significance scaling factor
     float effArea = 8.0 * M_PI * PS_SQR(SIGMA_SMTH);
-    psMetadataAddF32(recipe, PS_LIST_TAIL, "EFFECTIVE_AREA", PS_META_REPLACE, "Effective Area", effArea);
-    psMetadataAddF32(recipe, PS_LIST_TAIL, "SIGNIFICANCE_SCALE_FACTOR", PS_META_REPLACE,
-                     "Signicance scale factor", factor);
+    psMetadataAddF32(readout->analysis, PS_LIST_TAIL, "EFFECTIVE_AREA", PS_META_REPLACE, "Effective Area", effArea);
+    psMetadataAddF32(readout->analysis, PS_LIST_TAIL, "SIGNIFICANCE_SCALE_FACTOR", PS_META_REPLACE, "Signicance scale factor", factor);
 
     // XXX multithread this if needed
