Index: branches/eam_branches/ipp-20110213/ppStack/src/ppStackArguments.c
===================================================================
--- branches/eam_branches/ipp-20110213/ppStack/src/ppStackArguments.c	(revision 30702)
+++ branches/eam_branches/ipp-20110213/ppStack/src/ppStackArguments.c	(revision 30772)
@@ -110,4 +110,10 @@
 {
     assert(config);
+
+    // generic arguments (version, dumpconfig)
+    PS_ARGUMENTS_GENERIC( ppStack, config, argc, argv );
+
+    // thread arguments
+    PS_ARGUMENTS_THREADS( ppStack, config, argc, argv )
 
     {
@@ -181,5 +187,4 @@
     psMetadataAddStr(arguments, PS_LIST_TAIL, "-temp-variance", 0, "Suffix for temporary variance maps", NULL);
     psMetadataAddBool(arguments, PS_LIST_TAIL, "-temp-delete", 0, "Delete temporary files on completion?", false);
-    psMetadataAddS32(arguments, PS_LIST_TAIL, "-threads", 0, "Number of threads to use", 0);
     psMetadataAddBool(arguments, PS_LIST_TAIL, "-visual", 0, "visualisation", false);
 
@@ -238,10 +243,4 @@
     valueArgStr(arguments, "-stats", "STATS", arguments);
 
-    int numThreads = psMetadataLookupS32(NULL, arguments, "-threads"); // Number of threads
-    if (numThreads > 0 && !psThreadPoolInit(numThreads)) {
-        psError(PPSTACK_ERR_ARGUMENTS, false, "Unable to setup %d threads", numThreads);
-        return false;
-    }
-
     psMetadataAddBool(arguments, PS_LIST_TAIL, "PPSTACK.DEBUG.STACK", 0,
                       "Read old convolved images to debug stack?", debugStack);
Index: branches/eam_branches/ipp-20110213/ppStack/src/ppStackFiles.c
===================================================================
--- branches/eam_branches/ipp-20110213/ppStack/src/ppStackFiles.c	(revision 30702)
+++ branches/eam_branches/ipp-20110213/ppStack/src/ppStackFiles.c	(revision 30772)
@@ -65,6 +65,5 @@
     for (int i = 0; i < numLeaks; i++) {
         psMemBlock *mb = leaks[i];
-        fprintf(memFile, "%12lu\t%12zd\t%s:%d\n", mb->id, mb->userMemorySize,
-                mb->file, mb->lineno);
+        fprintf(memFile, "%12lu\t%12zd\t%s:%d\n", mb->id, mb->userMemorySize, mb->file, mb->lineno);
         total += mb->userMemorySize;
     }
@@ -75,6 +74,4 @@
     num++;
 }
-
-
 
 // Activate/deactivate a list of files
Index: branches/eam_branches/ipp-20110213/ppStack/src/ppStackLoop.c
===================================================================
--- branches/eam_branches/ipp-20110213/ppStack/src/ppStackLoop.c	(revision 30702)
+++ branches/eam_branches/ipp-20110213/ppStack/src/ppStackLoop.c	(revision 30772)
@@ -55,6 +55,5 @@
     }
 
-    // Start threading
-    ppStackThreadInit();
+    // Define threading elements
     ppStackThreadData *stack = ppStackThreadDataSetup(options, config, true);
     if (!stack) {
Index: branches/eam_branches/ipp-20110213/ppStack/src/ppStackMatch.c
===================================================================
--- branches/eam_branches/ipp-20110213/ppStack/src/ppStackMatch.c	(revision 30702)
+++ branches/eam_branches/ipp-20110213/ppStack/src/ppStackMatch.c	(revision 30772)
@@ -142,5 +142,5 @@
     bool mdok;                          // Status of MD lookup
     float penalty = psMetadataLookupF32(NULL, ppsub, "PENALTY"); // Penalty for wideness
-    int threads = psMetadataLookupS32(NULL, config->arguments, "-threads"); // Number of threads
+    int threads = psMetadataLookupS32(NULL, config->arguments, "NTHREADS"); // Number of threads
 
     // Replaced pmReadoutMaskNonfinite with pmReadoutMaskInvalid (tests for already masked pixels)
Index: branches/eam_branches/ipp-20110213/ppStack/src/ppStackReject.c
===================================================================
--- branches/eam_branches/ipp-20110213/ppStack/src/ppStackReject.c	(revision 30702)
+++ branches/eam_branches/ipp-20110213/ppStack/src/ppStackReject.c	(revision 30772)
@@ -55,5 +55,5 @@
 
     // Reject bad pixels
-    if (psMetadataLookupS32(NULL, config->arguments, "-threads") > 0) {
+    if (psMetadataLookupS32(NULL, config->arguments, "NTHREADS") > 0) {
         pmStackRejectThreadsInit();
     }
Index: branches/eam_branches/ipp-20110213/ppStack/src/ppStackThread.c
===================================================================
--- branches/eam_branches/ipp-20110213/ppStack/src/ppStackThread.c	(revision 30702)
+++ branches/eam_branches/ipp-20110213/ppStack/src/ppStackThread.c	(revision 30772)
@@ -101,5 +101,5 @@
     }
 
-    int numThreads = psMetadataLookupS32(NULL, config->arguments, "-threads"); // Number of threads
+    int numThreads = psMetadataLookupS32(NULL, config->arguments, "NTHREADS"); // Number of threads
 
     // Generate readouts for each input file in each file group
@@ -248,5 +248,5 @@
 
 
-void ppStackThreadInit(void)
+void ppStackSetThreads(void)
 {
     static bool threaded = false;       // Are we running threaded?
Index: branches/eam_branches/ipp-20110213/ppStack/src/ppStackThread.h
===================================================================
--- branches/eam_branches/ipp-20110213/ppStack/src/ppStackThread.h	(revision 30702)
+++ branches/eam_branches/ipp-20110213/ppStack/src/ppStackThread.h	(revision 30772)
@@ -43,5 +43,5 @@
 
 // Initialise the threads
-void ppStackThreadInit(void);
+void ppStackSetThreads(void);
 
 
