Index: trunk/FACT++/src/datalogger.cc
===================================================================
--- trunk/FACT++/src/datalogger.cc	(revision 11250)
+++ trunk/FACT++/src/datalogger.cc	(revision 11251)
@@ -1047,4 +1047,5 @@
     delete fOpenedRunFiles;
     delete fNumSubAndFits;
+    delete fStatsMonitoring;
 
     if (fDebugIsOn)
@@ -2513,4 +2514,7 @@
 */
 // --------------------------------------------------------------------------
+
+#include "Main.h"
+/*
 void RunThread(DataLogger* logger)
 {
@@ -2520,8 +2524,11 @@
     Readline::Stop();    
 }
+*/
 // --------------------------------------------------------------------------
 template<class T>
 int RunShell(Configuration &conf)
 {
+    return Main<T, DataLogger>(conf, true);
+/*
     static T shell(conf.GetName().c_str(), conf.Get<int>("console")!=1);
 
@@ -2570,4 +2577,5 @@
 
     return 0;
+*/
 }
 
Index: trunk/FACT++/src/drivectrl.cc
===================================================================
--- trunk/FACT++/src/drivectrl.cc	(revision 11250)
+++ trunk/FACT++/src/drivectrl.cc	(revision 11251)
@@ -859,4 +859,7 @@
 // ------------------------------------------------------------------------
 
+#include "Main.h"
+
+/*
 void RunThread(StateMachineImp *io_service)
 {
@@ -866,5 +869,5 @@
     Readline::Stop();
 }
-
+*/
 /*
 template<class S, class T>
@@ -894,4 +897,6 @@
 int RunShell(Configuration &conf)
 {
+    return Main<T, StateMachineDrive<S, R>>(conf);
+/*
     static T shell(conf.GetName().c_str(), conf.Get<int>("console")!=1);
 
@@ -939,4 +944,5 @@
 
     return 0;
+    */
 }
 
Index: trunk/FACT++/src/fadctrl.cc
===================================================================
--- trunk/FACT++/src/fadctrl.cc	(revision 11250)
+++ trunk/FACT++/src/fadctrl.cc	(revision 11251)
@@ -1682,5 +1682,7 @@
 // ------------------------------------------------------------------------
 
-
+#include "Main.h"
+
+/*
 void RunThread(StateMachineImp *io_service)
 {
@@ -1690,5 +1692,5 @@
     Readline::Stop();
 }
-
+*/
 /*
 template<class S>
@@ -1718,4 +1720,6 @@
 int RunShell(Configuration &conf)
 {
+    return Main<T, StateMachineFAD<S>>(conf);
+/*
     static T shell(conf.GetName().c_str(), conf.Get<int>("console")!=1);
 
@@ -1762,4 +1766,5 @@
 
     return 0;
+    */
 }
 
Index: trunk/FACT++/src/fscctrl.cc
===================================================================
--- trunk/FACT++/src/fscctrl.cc	(revision 11250)
+++ trunk/FACT++/src/fscctrl.cc	(revision 11251)
@@ -530,4 +530,7 @@
 // ------------------------------------------------------------------------
 
+#include "Main.h"
+
+/*
 void RunThread(StateMachineImp *io_service)
 {
@@ -537,5 +540,5 @@
     Readline::Stop();
 }
-
+*/
 /*
 template<class S, class T>
@@ -566,4 +569,6 @@
 int RunShell(Configuration &conf)
 {
+    return Main<T, StateMachineFSC<S, R>>(conf);
+/*
     static T shell(conf.GetName().c_str(), conf.Get<int>("console")!=1);
 
@@ -611,4 +616,5 @@
 
     return 0;
+*/
 }
 
Index: trunk/FACT++/src/ftmctrl.cc
===================================================================
--- trunk/FACT++/src/ftmctrl.cc	(revision 11250)
+++ trunk/FACT++/src/ftmctrl.cc	(revision 11251)
@@ -1844,4 +1844,7 @@
 // ------------------------------------------------------------------------
 
+#include "Main.h"
+
+/*
 void RunThread(StateMachineImp *io_service)
 {
@@ -1851,5 +1854,5 @@
     Readline::Stop();
 }
-
+*/
 /*
 template<class S, class T>
@@ -1879,4 +1882,6 @@
 int RunShell(Configuration &conf)
 {
+    return Main<T, StateMachineFTM<S, R>>(conf);
+/*
     static T shell(conf.GetName().c_str(), conf.Get<int>("console")!=1);
 
@@ -1924,4 +1929,5 @@
 
     return 0;
+    */
 }
 
Index: trunk/FACT++/src/scheduler.cc
===================================================================
--- trunk/FACT++/src/scheduler.cc	(revision 11250)
+++ trunk/FACT++/src/scheduler.cc	(revision 11251)
@@ -729,5 +729,6 @@
 
 // ------------------------------------------------------------------------
-
+#include "Main.h"
+/*
 void RunThread(StateMachineImp *io_service)
 {
@@ -737,5 +738,5 @@
     Readline::Stop();
 }
-
+*/
 /*
 template<class S>
@@ -766,4 +767,6 @@
 int RunShell(Configuration &conf)
 {
+    return Main<T, AutoScheduler<S>>(conf);
+    /*
     static T shell(conf.GetName().c_str(), conf.Get<int>("console")!=1);
 
@@ -812,4 +815,5 @@
 
     return 0;
+*/
 }
 
