Index: trunk/ppStats/src/ppStats.h
===================================================================
--- trunk/ppStats/src/ppStats.h	(revision 13923)
+++ trunk/ppStats/src/ppStats.h	(revision 13993)
@@ -1,2 +1,3 @@
+
 #ifndef PP_STATS_H
 #define PP_STATS_H
@@ -4,19 +5,63 @@
 #define PPSTATS_RECIPE "PPSTATS"
 
-#include <psmodules.h>
+typedef struct {
+    // Inputs
+    psFits *fits;                       // Input file handle
+    pmFPA *fpa;                         // FPA to analyse
+    pmFPAview *view;                    // View to analyse
+    // Stuff to output
+    psStats *stats;                     // Statistics to calculate
+    bool doStats;                       // Do statistics?
+    bool fileLevel;                     // Output file level?
+    psList *headers;                    // Headers to read
+    psList *concepts;                   // Concepts to read
+    psList *summary;                    // Summary statistics to calculate
+    // Options for input data
+    float sample;                       // Fraction of cell to sample for statistics
+    psMaskType maskVal;                 // Mask value for images
+    psList *chips;                      // Chips to look at
+    psList *cells;                      // Cells to look at
+} ppStatsData;
 
-#include "ppStatsData.h"
-#include "ppStatsSetupFromRecipe.h"
-#include "ppStatsLoop.h"
-#include "ppStatsVersion.h"
-#include "ppStatsFringe.h"
+// Allocator
+ppStatsData *ppStatsDataAlloc(void);
 
-// Perform the ppStats steps
-psMetadata *ppStats(psMetadata *out,
-                    pmFPA *fpa,         // FPA for which to get statistics
-                    pmFPAview *view,    // View for analysis
-                    psMaskType maskVal, // Value to mask
-                    pmConfig *config    // Configuration
+/// Perform the ppStats steps on the given FPA (optionally for specified view) 
+psMetadata *ppStatsFPA(psMetadata *out,
+		       pmFPA *fpa,         // FPA for which to get statistics
+		       pmFPAview *view,    // View for analysis
+		       psMaskType maskVal, // Value to mask
+		       pmConfig *config    // Configuration
     );
 
+/// Supplement the statistics with the fringe solution
+bool ppStatsFringe(psMetadata *stats,     ///< Statistics metadata to supplement
+                   const pmChip *chip,    ///< The chip containing the solution
+                   const char *root,      ///< Name of output entry
+                   const char *fringeName ///< Name of the solution in the chip->analysis
+    );
+
+
+/// Loop over the input image and do all the hard work
+psMetadata *ppStatsLoop(psExit *result,
+                        ppStatsData *data, // The data
+                        const pmConfig *config // Configuration
+    );
+
+/// Set up the options and input/output files
+ppStatsData *ppStatsSetupFromArgs(int *argc, char *argv[], // Command-line arguments
+                                  pmConfig *config // Configuration
+    );
+
+bool ppStatsSetupFromRecipe(ppStatsData *data, // Data for running ppStats
+                            pmConfig *config // Configuration
+    );
+
+
+/// Return short version information
+psString ppStatsVersion(void);
+
+/// Return long version information
+psString ppStatsVersionLong(void);
+
 #endif
