Index: src/Fragmentation/Automation/Controller/CommandRegistry.cpp
===================================================================
--- src/Fragmentation/Automation/Controller/CommandRegistry.cpp	(revision 7ca772e57b80836e2c9d001aebd41bf0608a0b41)
+++ src/Fragmentation/Automation/Controller/CommandRegistry.cpp	(revision 7ca772e57b80836e2c9d001aebd41bf0608a0b41)
@@ -0,0 +1,36 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010-2012 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * CommandRegistry.cpp
+ *
+ *  Created on: Dec 11, 2011
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+// boost asio needs specific operator new
+#include <boost/asio.hpp>
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include "Controller/CommandRegistry.hpp"
+
+#include "CodePatterns/Registry_impl.hpp"
+
+
+CommandRegistry::CommandRegistry()
+{}
+
+CommandRegistry::~CommandRegistry()
+{}
+
+CONSTRUCT_REGISTRY(Operation)
Index: src/Fragmentation/Automation/Controller/CommandRegistry.hpp
===================================================================
--- src/Fragmentation/Automation/Controller/CommandRegistry.hpp	(revision 7ca772e57b80836e2c9d001aebd41bf0608a0b41)
+++ src/Fragmentation/Automation/Controller/CommandRegistry.hpp	(revision 7ca772e57b80836e2c9d001aebd41bf0608a0b41)
@@ -0,0 +1,27 @@
+/*
+ * CommandRegistry.hpp
+ *
+ *  Created on: Dec 11, 2011
+ *      Author: heber
+ */
+
+#ifndef COMMANDREGISTRY_HPP_
+#define COMMANDREGISTRY_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Controller/Commands/Operation.hpp"
+#include "CodePatterns/Registry.hpp"
+
+class CommandRegistry : public Registry<Operation>
+{
+public:
+  CommandRegistry();
+  ~CommandRegistry();
+
+};
+
+#endif /* COMMANDREGISTRY_HPP_ */
Index: src/Fragmentation/Automation/Controller/FragmentController.cpp
===================================================================
--- src/Fragmentation/Automation/Controller/FragmentController.cpp	(revision 50f4184e01c29a43b8df7405617024a05b8b2f9e)
+++ src/Fragmentation/Automation/Controller/FragmentController.cpp	(revision 7ca772e57b80836e2c9d001aebd41bf0608a0b41)
@@ -29,4 +29,8 @@
 #include "Controller/FragmentController.hpp"
 #include "Controller/Commands/Operation.hpp"
+#include "Controller/Commands/CheckResultsOperation.hpp"
+#include "Controller/Commands/ReceiveJobsOperation.hpp"
+#include "Controller/Commands/SendResultsOperation.hpp"
+#include "Controller/Commands/ShutdownOperation.hpp"
 
 /** Constructor of class FragmentController.
@@ -38,11 +42,13 @@
 FragmentController::FragmentController(
     boost::asio::io_service& io_service) :
-    connection_(io_service),
-    recjobs(connection_),
-    checkres(connection_),
-    sendres(connection_),
-    shutdown(connection_)
+    connection_(io_service)
 {
   Info info(__FUNCTION__);
+
+  // insert commands into registry
+  Commands.registerInstance(new CheckResultsOperation(connection_));
+  Commands.registerInstance(new ReceiveJobsOperation(connection_));
+  Commands.registerInstance(new SendResultsOperation(connection_));
+  Commands.registerInstance(new ShutdownOperation(connection_));
 }
 
@@ -51,4 +57,21 @@
  */
 FragmentController::~FragmentController()
-{}
+{
+  Commands.cleanup();
+}
 
+/** Getter for Exitflag of all any Operation.
+ *
+ * We simply go through all of them and check which failed.
+ *
+ * @return Combined Exitflag of all Operations in \a Commands.
+ */
+size_t FragmentController::getExitflag() const
+{
+  for (CommandRegistry::const_iterator iter = Commands.getBeginIter();
+      iter != Commands.getEndIter(); ++iter)
+    if ((iter->second)->getExitflag() != 0)
+      return (iter->second)->getExitflag();
+  return 0;
+}
+
Index: src/Fragmentation/Automation/Controller/FragmentController.hpp
===================================================================
--- src/Fragmentation/Automation/Controller/FragmentController.hpp	(revision 50f4184e01c29a43b8df7405617024a05b8b2f9e)
+++ src/Fragmentation/Automation/Controller/FragmentController.hpp	(revision 7ca772e57b80836e2c9d001aebd41bf0608a0b41)
@@ -22,9 +22,5 @@
 #include "FragmentResult.hpp"
 
-#include "Controller/Commands/Operation.hpp"
-#include "Controller/Commands/CheckResultsOperation.hpp"
-#include "Controller/Commands/ReceiveJobsOperation.hpp"
-#include "Controller/Commands/SendResultsOperation.hpp"
-#include "Controller/Commands/ShutdownOperation.hpp"
+#include "Controller/CommandRegistry.hpp"
 
 /** The FragmentController sends bunches of jobs to a FragmentScheduler,
@@ -43,4 +39,7 @@
   ~FragmentController();
 
+  /// getter for operations exit flag.
+  size_t getExitflag() const;
+
 protected:
   /// The Connection to the server.
@@ -48,24 +47,6 @@
 
 public:
-
-  ReceiveJobsOperation recjobs;
-  CheckResultsOperation checkres;
-  SendResultsOperation  sendres;
-  ShutdownOperation shutdown;
-
-  // get the exit flag of the last operations
-  size_t getExitflag() const
-  {
-    if (recjobs.getExitflag() != 0)
-      return recjobs.getExitflag();
-    if (checkres.getExitflag() != 0)
-      return checkres.getExitflag();
-    if (sendres.getExitflag() != 0)
-      return sendres.getExitflag();
-    if (shutdown.getExitflag() != 0)
-      return shutdown.getExitflag();
-    return 0;
-  }
-
+  /// Registry with all commands of this controller
+  CommandRegistry Commands;
 };
 
Index: c/Fragmentation/Automation/Controller/JobAdder.cpp
===================================================================
--- src/Fragmentation/Automation/Controller/JobAdder.cpp	(revision 50f4184e01c29a43b8df7405617024a05b8b2f9e)
+++ 	(revision )
@@ -1,82 +1,0 @@
-/*
- * Project: MoleCuilder
- * Description: creates and alters molecular systems
- * Copyright (C)  2011 University of Bonn. All rights reserved.
- * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
- */
-
-/*
- * \file JobAdder.cpp
- *
- * This file strongly follows the Serialization example from the boost::asio
- * library (see client.cpp)
- *
- *  Created on: Nov 27, 2011
- *      Author: heber
- */
-
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-// boost asio needs specific operator new
-#include <boost/asio.hpp>
-
-#include "CodePatterns/MemDebug.hpp"
-
-#include <iostream>
-#include <vector>
-#include <boost/lexical_cast.hpp>
-
-#include "atexit.hpp"
-#include "CodePatterns/Info.hpp"
-#include "CodePatterns/Log.hpp"
-#include "Controller/FragmentController.hpp"
-#include "FragmentJob.hpp"
-#include "FragmentResult.hpp"
-
-
-int main(int argc, char* argv[])
-{
-  // from this moment on, we need to be sure to deeinitialize in the correct order
-  // this is handled by the cleanup function
-  atexit(cleanUp);
-
-  setVerbosity(3);
-
-  size_t Exitflag = 0;
-  try
-  {
-    // Check command line arguments.
-    if (argc != 4)
-    {
-      std::cerr << "Usage: " << argv[0] << " <host> <port> <number of jobs>" << std::endl;
-      return 1;
-    }
-    const int NoJobs = boost::lexical_cast<int>(argv[3]);
-    boost::asio::io_service io_service;
-    FragmentController controller(io_service);
-
-    LOG(1, "INFO: Creating " << NoJobs << " jobs for the server.");
-    std::vector<FragmentJob> jobs;
-    for (JobId_t i = 1; i <= NoJobs; ++i) {
-      FragmentJob testJob(std::string("do something"), i);
-      jobs.push_back(testJob);
-    }
-    controller.recjobs.addJobs(jobs);
-    controller.recjobs(argv[1], argv[2]);
-    {
-      Info info("io_service");
-      io_service.run();
-    }
-    Exitflag = controller.getExitflag();
-  }
-  catch (std::exception& e)
-  {
-    std::cerr << e.what() << std::endl;
-  }
-
-  return Exitflag;
-}
Index: c/Fragmentation/Automation/Controller/ResultChecker.cpp
===================================================================
--- src/Fragmentation/Automation/Controller/ResultChecker.cpp	(revision 50f4184e01c29a43b8df7405617024a05b8b2f9e)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/*
- * Project: MoleCuilder
- * Description: creates and alters molecular systems
- * Copyright (C)  2011 University of Bonn. All rights reserved.
- * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
- */
-
-/*
- * \file ResultChecker.cpp
- *
- * This file strongly follows the Serialization example from the boost::asio
- * library (see client.cpp)
- *
- *  Created on: Nov 27, 2011
- *      Author: heber
- */
-
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-// boost asio needs specific operator new
-#include <boost/asio.hpp>
-
-#include "CodePatterns/MemDebug.hpp"
-
-#include <iostream>
-#include <vector>
-
-#include "atexit.hpp"
-#include "CodePatterns/Info.hpp"
-#include "CodePatterns/Log.hpp"
-#include "Controller/FragmentController.hpp"
-#include "FragmentJob.hpp"
-#include "FragmentResult.hpp"
-
-
-int main(int argc, char* argv[])
-{
-  // from this moment on, we need to be sure to deeinitialize in the correct order
-  // this is handled by the cleanup function
-  atexit(cleanUp);
-
-  setVerbosity(3);
-
-  size_t Exitflag = 0;
-  try
-  {
-    // Check command line arguments.
-    if (argc != 3)
-    {
-      std::cerr << "Usage: " << argv[0] << " <host> <port>" << std::endl;
-      return 1;
-    }
-
-    boost::asio::io_service io_service;
-    FragmentController controller(io_service);
-
-    controller.checkres(argv[1], argv[2]);
-    {
-      Info info("io_service");
-      io_service.run();
-    }
-    size_t doneJobs = controller.checkres.getDoneJobs();
-    LOG(1, "INFO: " << doneJobs << " jobs are calculated so far.");
-    Exitflag = controller.getExitflag();
-  }
-  catch (std::exception& e)
-  {
-    std::cerr << e.what() << std::endl;
-  }
-
-  return Exitflag;
-}
Index: c/Fragmentation/Automation/Controller/ResultGetter.cpp
===================================================================
--- src/Fragmentation/Automation/Controller/ResultGetter.cpp	(revision 50f4184e01c29a43b8df7405617024a05b8b2f9e)
+++ 	(revision )
@@ -1,86 +1,0 @@
-/*
- * Project: MoleCuilder
- * Description: creates and alters molecular systems
- * Copyright (C)  2011 University of Bonn. All rights reserved.
- * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
- */
-
-/*
- * \file ResultGetter.cpp
- *
- * This file strongly follows the Serialization example from the boost::asio
- * library (see client.cpp)
- *
- *  Created on: Nov 27, 2011
- *      Author: heber
- */
-
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-// boost asio needs specific operator new
-#include <boost/asio.hpp>
-
-#include "CodePatterns/MemDebug.hpp"
-
-#include <iostream>
-#include <vector>
-
-#include "atexit.hpp"
-#include "CodePatterns/Info.hpp"
-#include "CodePatterns/Log.hpp"
-#include "Controller/FragmentController.hpp"
-#include "FragmentJob.hpp"
-#include "FragmentResult.hpp"
-
-
-int main(int argc, char* argv[])
-{
-  // from this moment on, we need to be sure to deeinitialize in the correct order
-  // this is handled by the cleanup function
-  atexit(cleanUp);
-
-  setVerbosity(3);
-
-  size_t Exitflag = 0;
-  try
-  {
-    // Check command line arguments.
-    if (argc != 3)
-    {
-      std::cerr << "Usage: " << argv[0] << " <host> <port>" << std::endl;
-      return 1;
-    }
-
-    boost::asio::io_service io_service;
-    FragmentController controller(io_service);
-
-    std::vector<FragmentJob> jobs;
-    {
-      FragmentJob testJob(std::string("do something"), 1);
-      FragmentJob othertestJob(std::string("do something else"), 2);
-      jobs.push_back(testJob);
-      jobs.push_back(othertestJob);
-    }
-
-    controller.sendres(argv[1], argv[2]);
-    {
-      Info info("io_service");
-      io_service.run();
-    }
-    std::vector<FragmentResult> results = controller.sendres.getResults();
-    for (std::vector<FragmentResult>::const_iterator iter = results.begin();
-        iter != results.end(); ++iter)
-      LOG(1, "RESULT: job #"+toString((*iter).getId())+": "+toString((*iter).result));
-    Exitflag = controller.getExitflag();
-  }
-  catch (std::exception& e)
-  {
-    std::cerr << e.what() << std::endl;
-  }
-
-  return Exitflag;
-}
Index: c/Fragmentation/Automation/Controller/Shutdowner.cpp
===================================================================
--- src/Fragmentation/Automation/Controller/Shutdowner.cpp	(revision 50f4184e01c29a43b8df7405617024a05b8b2f9e)
+++ 	(revision )
@@ -1,74 +1,0 @@
-/*
- * Project: MoleCuilder
- * Description: creates and alters molecular systems
- * Copyright (C)  2011 University of Bonn. All rights reserved.
- * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
- */
-
-/*
- * \file Shutdowner.cpp
- *
- * This file strongly follows the Serialization example from the boost::asio
- * library (see client.cpp)
- *
- *  Created on: Dez 09, 2011
- *      Author: heber
- */
-
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-// boost asio needs specific operator new
-#include <boost/asio.hpp>
-
-#include "CodePatterns/MemDebug.hpp"
-
-#include <iostream>
-#include <vector>
-
-#include "atexit.hpp"
-#include "CodePatterns/Info.hpp"
-#include "CodePatterns/Log.hpp"
-#include "Controller/FragmentController.hpp"
-#include "FragmentJob.hpp"
-#include "FragmentResult.hpp"
-
-
-int main(int argc, char* argv[])
-{
-  // from this moment on, we need to be sure to deeinitialize in the correct order
-  // this is handled by the cleanup function
-  atexit(cleanUp);
-
-  setVerbosity(3);
-
-  size_t Exitflag = 0;
-  try
-  {
-    // Check command line arguments.
-    if (argc != 3)
-    {
-      std::cerr << "Usage: " << argv[0] << " <host> <port>" << std::endl;
-      return 1;
-    }
-
-    boost::asio::io_service io_service;
-    FragmentController controller(io_service);
-
-    controller.shutdown(argv[1], argv[2]);
-    {
-      Info info("io_service");
-      io_service.run();
-    }
-    Exitflag = controller.getExitflag();
-  }
-  catch (std::exception& e)
-  {
-    std::cerr << e.what() << std::endl;
-  }
-
-  return Exitflag;
-}
Index: src/Fragmentation/Automation/Makefile.am
===================================================================
--- src/Fragmentation/Automation/Makefile.am	(revision 50f4184e01c29a43b8df7405617024a05b8b2f9e)
+++ src/Fragmentation/Automation/Makefile.am	(revision 7ca772e57b80836e2c9d001aebd41bf0608a0b41)
@@ -31,4 +31,5 @@
 FRAGMENTATIONAUTOMATIONSOURCE = \
   atexit.cpp \
+  Controller/CommandRegistry.cpp \
   Controller/FragmentController.cpp \
   Controller/Commands/CheckResultsOperation.cpp \
@@ -42,4 +43,5 @@
   Connection.hpp \
   ControllerChoices.hpp \
+  Controller/CommandRegistry.hpp \
   Controller/FragmentController.hpp \
   Controller/Commands/CheckResultsOperation.hpp \
@@ -59,5 +61,5 @@
 AM_CPPFLAGS = ${BOOST_CPPFLAGS} ${CodePatterns_CFLAGS}
 
-bin_PROGRAMS += JobAdder ResultChecker ResultGetter Server Shutdowner Worker
+bin_PROGRAMS += Controller Server Worker
 
 CONTROLLERSOURCE =
@@ -82,32 +84,8 @@
   FragmentWorker.hpp
 
-JobAdder_SOURCES = $(CONTROLLERSOURCE) $(CONTROLLERHEADER) Controller/JobAdder.cpp
-JobAdder_LDFLAGS = $(AM_LDFLAGS) $(BOOST_ASIO_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS) $(BOOST_THREAD_LDFLAGS) $(BOOST_SERIALIZATION_LDFLAGS)
-JobAdder_CXXFLAGS = $(AM_CPPFLAGS)
-JobAdder_LDADD = \
-  libMolecuilderFragmentationAutomation.la \
-  libMolecuilderFragmentJobs.la \
-  $(BOOST_ASIO_LIBS) \
-  $(BOOST_SERIALIZATION_LIBS) \
-  $(BOOST_THREAD_LIBS) \
-  $(BOOST_SYSTEM_LIBS) \
-  ${CodePatterns_LIBS}
-
-ResultChecker_SOURCES = $(CONTROLLERSOURCE) $(CONTROLLERHEADER) Controller/ResultChecker.cpp
-ResultChecker_LDFLAGS = $(AM_LDFLAGS) $(BOOST_ASIO_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS) $(BOOST_THREAD_LDFLAGS) $(BOOST_SERIALIZATION_LDFLAGS)
-ResultChecker_CXXFLAGS = $(AM_CPPFLAGS)
-ResultChecker_LDADD = \
-  libMolecuilderFragmentationAutomation.la \
-  libMolecuilderFragmentJobs.la \
-  $(BOOST_ASIO_LIBS) \
-  $(BOOST_SERIALIZATION_LIBS) \
-  $(BOOST_THREAD_LIBS) \
-  $(BOOST_SYSTEM_LIBS) \
-  ${CodePatterns_LIBS}
-
-ResultGetter_SOURCES = $(CONTROLLERSOURCE) $(CONTROLLERHEADER) Controller/ResultGetter.cpp
-ResultGetter_LDFLAGS = $(AM_LDFLAGS) $(BOOST_ASIO_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS) $(BOOST_THREAD_LDFLAGS) $(BOOST_SERIALIZATION_LDFLAGS)
-ResultGetter_CXXFLAGS = $(AM_CPPFLAGS)
-ResultGetter_LDADD = \
+Controller_SOURCES = $(CONTROLLERSOURCE) $(CONTROLLERHEADER) controller.cpp
+Controller_LDFLAGS = $(AM_LDFLAGS) $(BOOST_ASIO_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS) $(BOOST_THREAD_LDFLAGS) $(BOOST_SERIALIZATION_LDFLAGS)
+Controller_CXXFLAGS = $(AM_CPPFLAGS)
+Controller_LDADD = \
   libMolecuilderFragmentationAutomation.la \
   libMolecuilderFragmentJobs.la \
@@ -130,16 +108,4 @@
   ${CodePatterns_LIBS}
 
-Shutdowner_SOURCES = $(CONTROLLERSOURCE) $(CONTROLLERHEADER) Controller/Shutdowner.cpp
-Shutdowner_LDFLAGS = $(AM_LDFLAGS) $(BOOST_ASIO_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS) $(BOOST_THREAD_LDFLAGS) $(BOOST_SERIALIZATION_LDFLAGS)
-Shutdowner_CXXFLAGS = $(AM_CPPFLAGS)
-Shutdowner_LDADD = \
-  libMolecuilderFragmentationAutomation.la \
-  libMolecuilderFragmentJobs.la \
-  $(BOOST_ASIO_LIBS) \
-  $(BOOST_SERIALIZATION_LIBS) \
-  $(BOOST_THREAD_LIBS) \
-  $(BOOST_SYSTEM_LIBS) \
-  ${CodePatterns_LIBS}
-
 Worker_SOURCES = $(WORKERSOURCE) $(WORKERHEADER)
 Worker_LDFLAGS = $(AM_LDFLAGS) $(BOOST_ASIO_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS) $(BOOST_THREAD_LDFLAGS) $(BOOST_SERIALIZATION_LDFLAGS)
Index: src/Fragmentation/Automation/controller.cpp
===================================================================
--- src/Fragmentation/Automation/controller.cpp	(revision 7ca772e57b80836e2c9d001aebd41bf0608a0b41)
+++ src/Fragmentation/Automation/controller.cpp	(revision 7ca772e57b80836e2c9d001aebd41bf0608a0b41)
@@ -0,0 +1,218 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2011 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * \file controller.cpp
+ *
+ * This file strongly follows the Serialization example from the boost::asio
+ * library (see client.cpp)
+ *
+ *  Created on: Nov 27, 2011
+ *      Author: heber
+ */
+
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+// boost asio needs specific operator new
+#include <boost/asio.hpp>
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include <iostream>
+#include <vector>
+#include <map>
+
+#include "atexit.hpp"
+#include "CodePatterns/Info.hpp"
+#include "CodePatterns/Log.hpp"
+#include "Controller/FragmentController.hpp"
+#include "Controller/Commands/CheckResultsOperation.hpp"
+#include "Controller/Commands/ReceiveJobsOperation.hpp"
+#include "Controller/Commands/SendResultsOperation.hpp"
+#include "Controller/Commands/ShutdownOperation.hpp"
+#include "FragmentJob.hpp"
+#include "FragmentResult.hpp"
+
+enum CommandIndices {
+  UnknownCommandIndex = 0,
+  SendJobsIndex = 1,
+  CheckResultsIndex = 2,
+  ReceiveResultsIndex = 3,
+  ShutdownIndex = 4
+};
+
+void createjobs(std::vector<FragmentJob> &jobs)
+{
+  FragmentJob testJob(std::string("do something"), 1);
+  FragmentJob othertestJob(std::string("do something else"), 2);
+  jobs.push_back(testJob);
+  jobs.push_back(othertestJob);
+}
+
+void addjobs(FragmentController &controller, std::vector<FragmentJob> &jobs)
+{
+  ReceiveJobsOperation *recjobs = static_cast<ReceiveJobsOperation *>(
+      controller.Commands.getByName("receivejobs"));
+  recjobs->addJobs(jobs);
+}
+
+void sendjobs(FragmentController &controller, const std::string &host, const std::string &service)
+{
+  ReceiveJobsOperation *recjobs = static_cast<ReceiveJobsOperation *>(
+      controller.Commands.getByName("receivejobs"));
+  (*recjobs)(host, service);
+}
+
+void checkresults(FragmentController &controller, const std::string &host, const std::string &service)
+{
+  CheckResultsOperation *checkres = static_cast<CheckResultsOperation *>(
+      controller.Commands.getByName("checkresults"));
+  (*checkres)(host, service);
+}
+
+void printdonejobs(FragmentController &controller)
+{
+  CheckResultsOperation *checkres = static_cast<CheckResultsOperation *>(
+      controller.Commands.getByName("checkresults"));
+  const size_t doneJobs = checkres->getDoneJobs();
+  LOG(1, "INFO: " << doneJobs << " jobs are calculated so far.");
+}
+
+void receiveresults(FragmentController &controller, const std::string &host, const std::string &service)
+{
+  SendResultsOperation *sendres = static_cast<SendResultsOperation *>(
+      controller.Commands.getByName("sendresults"));
+  (*sendres)(host, service);
+}
+
+void printreceivedresults(FragmentController &controller)
+{
+  SendResultsOperation *sendres = static_cast<SendResultsOperation *>(
+      controller.Commands.getByName("sendresults"));
+  std::vector<FragmentResult> results = sendres->getResults();
+  for (std::vector<FragmentResult>::const_iterator iter = results.begin();
+      iter != results.end(); ++iter)
+    LOG(1, "RESULT: job #"+toString((*iter).getId())+": "+toString((*iter).result));
+}
+
+void shutdown(FragmentController &controller, const std::string &host, const std::string &service)
+{
+  ShutdownOperation *shutdown = static_cast<ShutdownOperation *>(
+      controller.Commands.getByName("shutdown"));
+  (*shutdown)(host, service);
+}
+
+/** Returns a unique index for every command to allow switching over it.
+ *
+ * \param &commandmap map with command strings
+ * \param &cmd command string
+ * \return index from CommandIndices: UnkownCommandIndex - unknown command, else - command index
+ */
+CommandIndices getCommandIndex(std::map<std::string, CommandIndices> &commandmap, const std::string &cmd)
+{
+  std::map<std::string, CommandIndices>::const_iterator iter = commandmap.find(cmd);
+  if (iter != commandmap.end())
+    return iter->second;
+  else
+    return UnknownCommandIndex;
+}
+
+
+int main(int argc, char* argv[])
+{
+  // from this moment on, we need to be sure to deeinitialize in the correct order
+  // this is handled by the cleanup function
+  atexit(cleanUp);
+
+  setVerbosity(3);
+
+  size_t Exitflag = 0;
+  std::map<std::string, CommandIndices> CommandsMap;
+  CommandsMap.insert( std::make_pair("sendjobs", SendJobsIndex) );
+  CommandsMap.insert( std::make_pair("checkresults", CheckResultsIndex) );
+  CommandsMap.insert( std::make_pair("receiveresults", ReceiveResultsIndex) );
+  CommandsMap.insert( std::make_pair("shutdown", ShutdownIndex) );
+  try
+  {
+    // Check command line arguments.
+    if (argc != 4)
+    {
+      std::cerr << "Usage: " << argv[0] << " <host> <port> <command>" << std::endl;
+      return 1;
+    }
+
+    boost::asio::io_service io_service;
+    FragmentController controller(io_service);
+
+    switch(getCommandIndex(CommandsMap, argv[3])) {
+      case SendJobsIndex:
+      {
+        std::vector<FragmentJob> jobs;
+        createjobs(jobs);
+        addjobs(controller, jobs);
+        sendjobs(controller, argv[1], argv[2]);
+        break;
+      }
+      case CheckResultsIndex:
+      {
+        checkresults(controller, argv[1], argv[2]);
+        break;
+      }
+      case ReceiveResultsIndex:
+      {
+        receiveresults(controller, argv[1], argv[2]);
+        break;
+      }
+      case ShutdownIndex:
+      {
+        shutdown(controller, argv[1], argv[2]);
+        break;
+      }
+      case UnknownCommandIndex:
+      default:
+        ELOG(0, "Unrecognized command '"+toString(argv[3])+"'.");
+        break;
+    }
+
+    {
+      Info info("io_service");
+      io_service.run();
+    }
+
+    switch(getCommandIndex(CommandsMap, argv[3])) {
+      case SendJobsIndex:
+        break;
+      case CheckResultsIndex:
+      {
+        printdonejobs(controller);
+        break;
+      }
+      case ReceiveResultsIndex:
+      {
+        printreceivedresults(controller);
+        break;
+      }
+      case ShutdownIndex:
+        break;
+      case UnknownCommandIndex:
+      default:
+        ELOG(0, "Unrecognized command '"+toString(argv[3])+"'.");
+        break;
+    }
+    Exitflag = controller.getExitflag();
+  }
+  catch (std::exception& e)
+  {
+    std::cerr << e.what() << std::endl;
+  }
+
+  return Exitflag;
+}
Index: tests/regression/Fragmentation/Automation/testsuite-fragmentation-automation-addingjobs.at
===================================================================
--- tests/regression/Fragmentation/Automation/testsuite-fragmentation-automation-addingjobs.at	(revision 50f4184e01c29a43b8df7405617024a05b8b2f9e)
+++ tests/regression/Fragmentation/Automation/testsuite-fragmentation-automation-addingjobs.at	(revision 7ca772e57b80836e2c9d001aebd41bf0608a0b41)
@@ -14,5 +14,5 @@
 
 # add two jobs via JobAdder
-AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/JobAdder 127.0.0.1 $CONTROLLERPORT 2], 0, [stdout], [ignore], [kill $server_pid])
+AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Controller 127.0.0.1 $CONTROLLERPORT sendjobs], 0, [stdout], [ignore], [kill $server_pid])
 AT_CHECK([fgrep "Sending 2 jobs ..." stdout], 0, [ignore], [ignore], [kill $server_pid])
 
@@ -22,5 +22,5 @@
 
 # shutdown
-AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Shutdowner 127.0.0.1 $CONTROLLERPORT], 0, [ignore], [ignore], [kill $server_pid])
+AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Controller 127.0.0.1 $CONTROLLERPORT shutdown], 0, [ignore], [ignore], [kill $server_pid])
 
 # check that server is truely down
Index: tests/regression/Fragmentation/Automation/testsuite-fragmentation-automation-checkstate.at
===================================================================
--- tests/regression/Fragmentation/Automation/testsuite-fragmentation-automation-checkstate.at	(revision 50f4184e01c29a43b8df7405617024a05b8b2f9e)
+++ tests/regression/Fragmentation/Automation/testsuite-fragmentation-automation-checkstate.at	(revision 7ca772e57b80836e2c9d001aebd41bf0608a0b41)
@@ -14,9 +14,9 @@
 
 # check jobs
-AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/ResultChecker 127.0.0.1 $CONTROLLERPORT], 0, [stdout], [ignore], [kill $server_pid])
+AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Controller 127.0.0.1 $CONTROLLERPORT checkresults], 0, [stdout], [ignore], [kill $server_pid])
 AT_CHECK([fgrep "0 jobs are calculated so far." stdout], 0, [ignore], [ignore], [kill $server_pid])
 
 # shutdown
-AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Shutdowner 127.0.0.1 $CONTROLLERPORT], 0, [ignore], [ignore], [kill $server_pid])
+AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Controller 127.0.0.1 $CONTROLLERPORT shutdown], 0, [ignore], [ignore], [kill $server_pid])
 
 # check that server is truely down
Index: tests/regression/Fragmentation/Automation/testsuite-fragmentation-automation-completerun.at
===================================================================
--- tests/regression/Fragmentation/Automation/testsuite-fragmentation-automation-completerun.at	(revision 50f4184e01c29a43b8df7405617024a05b8b2f9e)
+++ tests/regression/Fragmentation/Automation/testsuite-fragmentation-automation-completerun.at	(revision 7ca772e57b80836e2c9d001aebd41bf0608a0b41)
@@ -14,8 +14,8 @@
 
 # add two jobs via JobAdder
-AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/JobAdder 127.0.0.1 $CONTROLLERPORT 2], 0, [stdout], [ignore], [kill $server_pid])
+AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Controller 127.0.0.1 $CONTROLLERPORT sendjobs], 0, [stdout], [ignore], [kill $server_pid])
 AT_CHECK([fgrep "Sending 2 jobs ..." stdout], 0, [ignore], [ignore], [kill $server_pid])
 # Checking results
-AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/ResultChecker 127.0.0.1 $CONTROLLERPORT], 0, [stdout], [ignore], [kill $server_pid])
+AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Controller 127.0.0.1 $CONTROLLERPORT checkresults], 0, [stdout], [ignore], [kill $server_pid])
 AT_CHECK([fgrep "0 jobs are calculated so far." stdout], 0, [ignore], [ignore], [kill $server_pid])
 # start working
@@ -23,8 +23,8 @@
 AT_CHECK([fgrep "Calculating job #1" stdout], 0, [ignore], [ignore], [kill $server_pid])
 # Checking results 
-AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/ResultChecker 127.0.0.1 $CONTROLLERPORT], 0, [stdout], [ignore], [kill $server_pid])
+AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Controller 127.0.0.1 $CONTROLLERPORT checkresults], 0, [stdout], [ignore], [kill $server_pid])
 AT_CHECK([fgrep "1 jobs are calculated so far." stdout], 0, [ignore], [ignore], [kill $server_pid])
-# get first result 
-AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/ResultGetter 127.0.0.1 $CONTROLLERPORT], 0, [stdout], [ignore], [kill $server_pid])
+# get first result
+AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Controller 127.0.0.1 $CONTROLLERPORT receiveresults], 0, [stdout], [ignore], [kill $server_pid])
 AT_CHECK([fgrep "Received 1 results" stdout], 0, [ignore], [ignore], [kill $server_pid])
 AT_CHECK([fgrep -c "Nothing" stdout], 0, [stdout], [ignore], [kill $server_pid])
@@ -33,17 +33,17 @@
 AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Worker 127.0.0.1 $WORKERPORT], 0, [stdout], [ignore], [kill $server_pid])
 AT_CHECK([fgrep "Calculating job #2" stdout], 0, [ignore], [ignore], [kill $server_pid])
-# Checking results
-AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/ResultChecker 127.0.0.1 $CONTROLLERPORT], 0, [stdout], [ignore], [kill $server_pid])
+# Checking results 
+AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Controller 127.0.0.1 $CONTROLLERPORT checkresults], 0, [stdout], [ignore], [kill $server_pid])
 AT_CHECK([fgrep "1 jobs are calculated so far." stdout], 0, [ignore], [ignore], [kill $server_pid])
-# get second result
-AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/ResultGetter 127.0.0.1 $CONTROLLERPORT], 0, [stdout], [ignore], [kill $server_pid])
+# get second result 
+AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Controller 127.0.0.1 $CONTROLLERPORT receiveresults], 0, [stdout], [ignore], [kill $server_pid])
 AT_CHECK([fgrep "Received 1 results" stdout], 0, [ignore], [ignore], [kill $server_pid])
 AT_CHECK([fgrep -c "Nothing" stdout], 0, [stdout], [ignore], [kill $server_pid])
 AT_CHECK([grep "1" stdout], 0, [ignore], [ignore], [kill $server_pid])
 # get no more results 
-AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/ResultGetter 127.0.0.1 $CONTROLLERPORT], 0, [stdout], [ignore], [kill $server_pid])
+AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Controller 127.0.0.1 $CONTROLLERPORT receiveresults], 0, [stdout], [ignore], [kill $server_pid])
 AT_CHECK([grep "Nothing" stdout], 1, [ignore], [ignore], [kill $server_pid])
 # shutdown
-AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Shutdowner 127.0.0.1 $CONTROLLERPORT], 0, [stdout], [ignore], [kill $server_pid])
+AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Controller 127.0.0.1 $CONTROLLERPORT shutdown], 0, [stdout], [ignore], [kill $server_pid])
 
 # check that server is truely down
Index: tests/regression/Fragmentation/Automation/testsuite-fragmentation-automation-getresults.at
===================================================================
--- tests/regression/Fragmentation/Automation/testsuite-fragmentation-automation-getresults.at	(revision 50f4184e01c29a43b8df7405617024a05b8b2f9e)
+++ tests/regression/Fragmentation/Automation/testsuite-fragmentation-automation-getresults.at	(revision 7ca772e57b80836e2c9d001aebd41bf0608a0b41)
@@ -14,9 +14,9 @@
 
 # directly obtain 0 results
-AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/ResultGetter 127.0.0.1 $CONTROLLERPORT], 0, [stdout], [ignore], [kill $server_pid])
+AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Controller 127.0.0.1 $CONTROLLERPORT receiveresults], 0, [stdout], [ignore], [kill $server_pid])
 AT_CHECK([fgrep "RESULT" stdout], 1, [stdout], [ignore], [kill $server_pid])
 
 # shutdown
-AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Shutdowner 127.0.0.1 $CONTROLLERPORT], 0, [ignore], [ignore], [kill $server_pid])
+AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Controller 127.0.0.1 $CONTROLLERPORT shutdown], 0, [ignore], [ignore], [kill $server_pid])
 
 # check that server is truely down
Index: tests/regression/Fragmentation/Automation/testsuite-fragmentation-automation-server-shutdown.at
===================================================================
--- tests/regression/Fragmentation/Automation/testsuite-fragmentation-automation-server-shutdown.at	(revision 50f4184e01c29a43b8df7405617024a05b8b2f9e)
+++ tests/regression/Fragmentation/Automation/testsuite-fragmentation-automation-server-shutdown.at	(revision 7ca772e57b80836e2c9d001aebd41bf0608a0b41)
@@ -14,5 +14,5 @@
 
 # shutdown server again
-AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Shutdowner 127.0.0.1 $CONTROLLERPORT], 0, [stdout], [ignore], [kill $server_pid])
+AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Controller 127.0.0.1 $CONTROLLERPORT shutdown], 0, [stdout], [ignore], [kill $server_pid])
 AT_CHECK([grep "Operation completed." stdout], 0, [stdout], [ignore], [kill $server_pid])
 
Index: tests/regression/Fragmentation/Automation/testsuite-fragmentation-automation-server-worker.at
===================================================================
--- tests/regression/Fragmentation/Automation/testsuite-fragmentation-automation-server-worker.at	(revision 50f4184e01c29a43b8df7405617024a05b8b2f9e)
+++ tests/regression/Fragmentation/Automation/testsuite-fragmentation-automation-server-worker.at	(revision 7ca772e57b80836e2c9d001aebd41bf0608a0b41)
@@ -13,6 +13,6 @@
 AT_CHECK([sleep 1], 0, [ignore], [ignore], [kill $server_pid])
 
-# add one jobs
-AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/JobAdder 127.0.0.1 $CONTROLLERPORT 1], 0, [ignore], [ignore], [kill $server_pid])
+# add two jobs 
+AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Controller 127.0.0.1 $CONTROLLERPORT sendjobs], 0, [ignore], [ignore], [kill $server_pid])
 
 # first worker has a job
@@ -20,10 +20,14 @@
 AT_CHECK([fgrep "Job id: 1" stdout], 0, [ignore], [ignore], [kill $server_pid])
 
+# second worker has a job
+AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Worker 127.0.0.1 $WORKERPORT], 0, [stdout], [ignore], [kill $server_pid])
+AT_CHECK([fgrep "Job id: 2" stdout], 0, [ignore], [ignore], [kill $server_pid])
+
 # check number of done jobs 
-AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/ResultChecker 127.0.0.1 $CONTROLLERPORT], 0, [stdout], [ignore], [kill $server_pid])
-AT_CHECK([fgrep "1 jobs are calculated so far" stdout], 0, [ignore], [ignore], [kill $server_pid])
+AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Controller 127.0.0.1 $CONTROLLERPORT checkresults], 0, [stdout], [ignore], [kill $server_pid])
+AT_CHECK([fgrep "2 jobs are calculated so far" stdout], 0, [ignore], [ignore], [kill $server_pid])
 
-# shutdown controller socket
-AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Shutdowner 127.0.0.1 $CONTROLLERPORT], 0, [stdout], [ignore], [kill $server_pid])
+# shutdown controller socket 
+AT_CHECK([${AUTOTEST_PATH}/Fragmentation/Automation/Controller 127.0.0.1 $CONTROLLERPORT shutdown], 0, [stdout], [ignore], [kill $server_pid])
 
 # check that server is truely down
