Index: /branches/cnb_branches/cnb_branch_20090215/ppStack/src/ppStackArguments.c
===================================================================
--- /branches/cnb_branches/cnb_branch_20090215/ppStack/src/ppStackArguments.c	(revision 22721)
+++ /branches/cnb_branches/cnb_branch_20090215/ppStack/src/ppStackArguments.c	(revision 22722)
@@ -256,5 +256,5 @@
     valueArgRecipeStr(arguments, recipe, "-psf-model", "PSF.MODEL", recipe);
 
-    if (psMetadataLookupBool(NULL, arguments, "-viusal")) {
+    if (psMetadataLookupBool(NULL, arguments, "-visual")) {
         pmVisualSetVisual(true);
     }
Index: /branches/cnb_branches/cnb_branch_20090215/psModules/src/extras/pmVisual.c
===================================================================
--- /branches/cnb_branches/cnb_branch_20090215/psModules/src/extras/pmVisual.c	(revision 22721)
+++ /branches/cnb_branches/cnb_branch_20090215/psModules/src/extras/pmVisual.c	(revision 22722)
@@ -21,5 +21,5 @@
 #include "pmAstrometryObjects.h"
 #include "pmSubtractionStamps.h"
-
+#include "pmTrend2D.h"
 #include "pmFPAExtent.h"
 
@@ -34,4 +34,7 @@
 #include "pmSubtractionVisual.h"
 #include "pmStackVisual.h"
+#include "pmSourceVisual.h"
+
+//#define TESTING
 
 static bool isVisual = false;
@@ -50,4 +53,5 @@
     pmSubtractionVisualClose();
     pmStackVisualClose();
+    pmSourceVisualClose();
     //XXX handle psphot
     //    psphotVisualClose();
@@ -209,10 +213,14 @@
 
 bool pmVisualScaleImage(int kapaFD, psImage *inImage, const char *name, int channel, bool clip) {
-
     KiiImage image;
     KapaImageData data;
     Coords coords;
 
-    //make sure we have a compatible image type
+    //make sure we have a compatible image
+    if (inImage == NULL) {
+        fprintf(stderr, "Image is NULL, and cannot be displayed\n");
+        return false;
+    }
+
     if(inImage->type.type != PS_TYPE_F32) {
         fprintf(stderr, "Cannot display this image (imcompatible data type)\n");
@@ -221,4 +229,5 @@
 
     strcpy (coords.ctype, "RA---TAN");
+
 
     double min, max, stdev, mean;
Index: /branches/cnb_branches/cnb_branch_20090215/psModules/src/imcombine/pmPSFEnvelope.c
===================================================================
--- /branches/cnb_branches/cnb_branch_20090215/psModules/src/imcombine/pmPSFEnvelope.c	(revision 22721)
+++ /branches/cnb_branches/cnb_branch_20090215/psModules/src/imcombine/pmPSFEnvelope.c	(revision 22722)
@@ -33,5 +33,5 @@
 
 
-#define TESTING                         // Enable test output
+//#define TESTING                         // Enable test output
 #define PEAK_FLUX 1.0e4                 // Peak flux for each source
 #define SKY_VALUE 0.0e0                 // Sky value for fake image
Index: /branches/cnb_branches/cnb_branch_20090215/psModules/src/imcombine/pmStack.c
===================================================================
--- /branches/cnb_branches/cnb_branch_20090215/psModules/src/imcombine/pmStack.c	(revision 22721)
+++ /branches/cnb_branches/cnb_branch_20090215/psModules/src/imcombine/pmStack.c	(revision 22722)
@@ -33,8 +33,7 @@
 #define NUM_DIRECT_STDEV 5              // For less than this number of values, measure stdev directly
 
-//CNB change all of these to false
-#define TESTING                         // Enable test output
-#define TEST_X 2318                     // x coordinate to examine
-#define TEST_Y 2306                     // y coordinate to examine
+//#define TESTING                         // Enable test output
+//#define TEST_X 2318                     // x coordinate to examine
+//#define TEST_Y 2306                     // y coordinate to examine
 
 
Index: /branches/cnb_branches/cnb_branch_20090215/psModules/src/imcombine/pmStackVisual.c
===================================================================
--- /branches/cnb_branches/cnb_branch_20090215/psModules/src/imcombine/pmStackVisual.c	(revision 22721)
+++ /branches/cnb_branches/cnb_branch_20090215/psModules/src/imcombine/pmStackVisual.c	(revision 22722)
@@ -42,5 +42,4 @@
 }
 
-
 /** Display a test image
  * @param image to plot
@@ -48,13 +47,11 @@
  */
 bool pmStackVisualPlotTestImage(psImage *image, char *name) {
-
     if (!pmVisualIsVisual() || !plotTestImage) return true;
     if (!pmVisualInitWindow(&kapa, "pmStack:Images")) return false;
 
-    pmVisualScaleImage(kapa, image, name, 0, true);
+    if(!pmVisualScaleImage(kapa, image, (const char*)name, 0, true)) return false;
     pmVisualAskUser(&plotTestImage);
     return true;
 }
-
 
 #else
Index: /branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSourceVisual.c
===================================================================
--- /branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSourceVisual.c	(revision 22721)
+++ /branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSourceVisual.c	(revision 22722)
@@ -15,7 +15,14 @@
 
 static int kapa1 = -1;
+static bool plotPSF = true;
 // static int kapa2 = -1;
 // static int kapa3 = -1;
 
+bool pmSourceVisualClose() {
+    if (kapa1 != -1)
+        KiiClose(kapa1);
+    return true;
+}
+
 bool pmSourcePlotPoints3D (int myKapa, Graphdata *graphdata, psVector *xn, psVector *yn, psVector *zn, float theta, float phi);
 
@@ -27,5 +34,5 @@
     Graphdata graphdata;
 
-    if (!pmVisualIsVisual()) return true;
+    if (!pmVisualIsVisual() || !plotPSF) return true;
 
     if (kapa1 == -1) {
@@ -147,9 +154,5 @@
     // pause and wait for user input:
     // continue, save (provide name), ??
-    char key[10];
-    fprintf (stdout, "[c]ontinue? ");
-    if (!fgets(key, 8, stdin)) {
-        psWarning("Unable to read option");
-    }
+    pmVisualAskUser(&plotPSF);
     return true;
 }
Index: /branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSourceVisual.h
===================================================================
--- /branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSourceVisual.h	(revision 22721)
+++ /branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSourceVisual.h	(revision 22722)
@@ -12,4 +12,6 @@
 #define PM_SOURCE_VISUAL_H
 
+bool pmSourceVisualClose(void);
+
 /// @addtogroup Extras Miscellaneous Funtions
 /// @{
Index: /branches/cnb_branches/cnb_branch_20090215/psModules/src/psmodules.h
===================================================================
--- /branches/cnb_branches/cnb_branch_20090215/psModules/src/psmodules.h	(revision 22721)
+++ /branches/cnb_branches/cnb_branch_20090215/psModules/src/psmodules.h	(revision 22722)
@@ -100,4 +100,5 @@
 #include <pmReadoutCombine.h>
 #include <pmSubtractionVisual.h>
+#include <pmStackVisual.h>
 
 // the following headers are from psModule:objects
