Index: src/Fragmentation/Automation/ControllerChoices.hpp
===================================================================
--- src/Fragmentation/Automation/ControllerChoices.hpp	(revision e70b9dc00a22a0801131763acf7c71937581ac4d)
+++ src/Fragmentation/Automation/ControllerChoices.hpp	(revision e70b9dc00a22a0801131763acf7c71937581ac4d)
@@ -0,0 +1,26 @@
+/*
+ * ControllerChoices.hpp
+ *
+ *  Created on: Mar 2, 2012
+ *      Author: heber
+ */
+
+#ifndef CONTROLLERCHOICES_HPP_
+#define CONTROLLERCHOICES_HPP_
+
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+//!> Choices of the FragmentController in communication with FragmentScheduler
+enum ControllerChoices {
+  NoOperation,
+  ReceiveJobs,
+  CheckState,
+  SendResults
+};
+
+
+#endif /* CONTROLLERCHOICES_HPP_ */
Index: src/Fragmentation/Automation/FragmentController.cpp
===================================================================
--- src/Fragmentation/Automation/FragmentController.cpp	(revision b9c48666be399d007fd031b2d636eba8227f227d)
+++ src/Fragmentation/Automation/FragmentController.cpp	(revision e70b9dc00a22a0801131763acf7c71937581ac4d)
@@ -24,4 +24,5 @@
 
 #include <boost/bind.hpp>
+#include <boost/foreach.hpp>
 #include <iostream>
 #include <vector>
@@ -32,4 +33,5 @@
 #include "FragmentJob.hpp"
 #include "FragmentResult.hpp"
+#include "ControllerChoices.hpp"
 
 #include "FragmentController.hpp"
@@ -70,9 +72,7 @@
   if (!e)
   {
-    // Successfully established connection. Start operation to read the vector
-    // of jobs. The connection::async_write() function will automatically
-    // encode the data that is written to the underlying socket.
-    LOG(1, "INFO: Sending "+toString(jobs.size())+" jobs ...");
-    connection_.async_write(jobs,
+    // Successfully established connection. Give choice.
+    enum ControllerChoices choice = ReceiveJobs;
+    connection_.async_write(choice,
       boost::bind(&FragmentController::handle_SendJobs, this,
       boost::asio::placeholders::error));
@@ -104,9 +104,7 @@
   if (!e)
   {
-    // Successfully established connection. Start operation to read the vector
-    // of jobs. The connection::async_write() function will automatically
-    // encode the data that is written to the underlying socket.
-    LOG(1, "INFO: Checking number of done jobs ...");
-    connection_.async_read(doneJobs,
+    // Successfully established connection. Give choice.
+    enum ControllerChoices choice = CheckState;
+    connection_.async_write(choice,
       boost::bind(&FragmentController::handle_ReceiveDoneJobs, this,
       boost::asio::placeholders::error));
@@ -127,14 +125,46 @@
 }
 
-/** Callback function when jobs have been sent.
- *
- * \param e error code if something went wrong
- */
-void FragmentController::handle_SendJobs(const boost::system::error_code& e)
-{
-  Info info(__FUNCTION__);
-  if (!e)
-  {
-    LOG(1, "INFO: Sent jobs ...");
+/** Handle completion of a connect operation.
+ *
+ * \param e error code if something went wrong
+ * \param endpoint_iterator endpoint of the connection
+ */
+void FragmentController::handle_connect_get(const boost::system::error_code& e,
+    boost::asio::ip::tcp::resolver::iterator endpoint_iterator)
+{
+  Info info(__FUNCTION__);
+  if (!e)
+  {
+    // Successfully established connection. Give choice.
+    enum ControllerChoices choice = SendResults;
+    connection_.async_write(choice,
+      boost::bind(&FragmentController::handle_ReceivingResults, this,
+      boost::asio::placeholders::error));
+  } else if (endpoint_iterator != boost::asio::ip::tcp::resolver::iterator()) {
+    // Try the next endpoint.
+    connection_.socket().close();
+    boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator;
+    connection_.socket().async_connect(endpoint,
+      boost::bind(&FragmentController::handle_connect_check, this,
+      boost::asio::placeholders::error, ++endpoint_iterator));
+  } else {
+    // An error occurred. Log it and return. Since we are not starting a new
+    // operation the io_service will run out of work to do and the client will
+    // exit.
+    Exitflag = ErrorFlag;
+    ELOG(1, e.message());
+  }
+}
+
+/** Callback function when operation has been completed.
+ *
+ * \param e error code if something went wrong
+ */
+void FragmentController::handle_FinishOperation(const boost::system::error_code& e)
+{
+  Info info(__FUNCTION__);
+  if (!e)
+  {
+    LOG(1, "INFO: Operation completed.");
   }
   else
@@ -149,13 +179,93 @@
 }
 
+/** Callback function when jobs have been sent.
+ *
+ * \param e error code if something went wrong
+ */
+void FragmentController::handle_SendJobs(const boost::system::error_code& e)
+{
+  Info info(__FUNCTION__);
+  if (!e)
+  {
+    // Successfully established connection. Start operation to read the vector
+    // of jobs. The connection::async_write() function will automatically
+    // encode the data that is written to the underlying socket.
+    LOG(1, "INFO: Sending "+toString(jobs.size())+" jobs ...");
+    connection_.async_write(jobs,
+      boost::bind(&FragmentController::handle_FinishOperation, this,
+      boost::asio::placeholders::error));
+  }
+  else
+  {
+    // An error occurred.
+    Exitflag = ErrorFlag;
+    ELOG(1, e.message());
+  }
+
+  // Since we are not starting a new operation the io_service will run out of
+  // work to do and the client will exit.
+}
+
+/** Callback function when results have been received.
+ *
+ * \param e error code if something went wrong
+ */
+void FragmentController::handle_ReceivingResults(const boost::system::error_code& e)
+{
+  Info info(__FUNCTION__);
+  if (!e)
+  {
+    // The connection::async_read() function will automatically
+    // decode the data that is written to the underlying socket.
+    connection_.async_read(results,
+      boost::bind(&FragmentController::handle_ReceivedResults, this,
+      boost::asio::placeholders::error));
+  }
+  else
+  {
+    // An error occurred.
+    Exitflag = ErrorFlag;
+    ELOG(1, e.message());
+  }
+
+  // Since we are not starting a new operation the io_service will run out of
+  // work to do and the client will exit.
+}
+
 /** Callback function when doneJobs have been received.
  *
  * \param e error code if something went wrong
  */
+void FragmentController::handle_ReceivedResults(const boost::system::error_code& e)
+{
+  Info info(__FUNCTION__);
+
+  LOG(1, "INFO: Received "+toString(results.size())+" results ...");
+
+  handle_FinishOperation(e);
+}
+
+/** Callback function when doneJobs have been received.
+ *
+ * \param e error code if something went wrong
+ */
 void FragmentController::handle_ReceiveDoneJobs(const boost::system::error_code& e)
 {
   Info info(__FUNCTION__);
-  // Nothing to do.
-  LOG(1, "INFO: "+toString(doneJobs)+" jobs are currently done.");
+  if (!e)
+  {
+    // The connection::async_read() function will automatically
+    // decode the data that is written to the underlying socket.
+    LOG(1, "INFO: Checking number of done jobs ...");
+    connection_.async_read(doneJobs,
+      boost::bind(&FragmentController::handle_FinishOperation, this,
+      boost::asio::placeholders::error));
+  }
+  else
+  {
+    // An error occurred.
+    Exitflag = ErrorFlag;
+    ELOG(1, e.message());
+  }
 }
 
@@ -211,4 +321,22 @@
 }
 
+/** Internal function to connect to the endpoint of the server asynchronuously.
+ *
+ * We require internal connetion_ and host and service to be set up for this.
+ */
+void FragmentController::connect_get()
+{
+  Info info(__FUNCTION__);
+  // Resolve the host name into an IP address.
+  boost::asio::ip::tcp::resolver::iterator endpoint_iterator = getEndpointIterator();
+  boost::asio::ip::tcp::endpoint endpoint = *endpoint_iterator;
+
+  // Start an asynchronous connect operation.
+  std::cout << "Connecting to endpoint " << endpoint << " to get results " << std::endl;
+  connection_.socket().async_connect(endpoint,
+    boost::bind(&FragmentController::handle_connect_get, this,
+      boost::asio::placeholders::error, ++endpoint_iterator));
+}
+
 /** Internal function to disconnect connection_ correctly.
  *
@@ -225,5 +353,8 @@
 void FragmentController::addJobs(const std::vector<FragmentJob> &_jobs)
 {
-  jobs = _jobs;
+  jobs.reserve(jobs.size()+_jobs.size());
+  BOOST_FOREACH(FragmentJob job, _jobs) {
+    jobs.push_back(job);
+  }
 }
 
@@ -250,4 +381,26 @@
 }
 
+/** Getter for results.
+ *
+ * \sa calculateResults()
+ * \return vector of results for the added jobs (\sa addJobs()).
+ */
+std::vector<FragmentResult> FragmentController::getResults()
+{
+  Info info(__FUNCTION__);
+  return results;
+}
+
+/** Function to initiate receival of results.
+ *
+ */
+void FragmentController::obtainResults()
+{
+  // connect
+  connect_get();
+  //disconnect
+  disconnect();
+}
+
 /** Getter for doneJobs.
  *
Index: src/Fragmentation/Automation/FragmentController.hpp
===================================================================
--- src/Fragmentation/Automation/FragmentController.hpp	(revision b9c48666be399d007fd031b2d636eba8227f227d)
+++ src/Fragmentation/Automation/FragmentController.hpp	(revision e70b9dc00a22a0801131763acf7c71937581ac4d)
@@ -37,11 +37,18 @@
   ~FragmentController();
 
-  /// Handle completion of a accept operation.
+  /// Handle completion of a calculate operation.
   void handle_connect_calc(const boost::system::error_code& e,
       boost::asio::ip::tcp::resolver::iterator endpoint_iterator);
 
-  /// Handle completion of a accept operation.
+  /// Handle completion of a CheckResults operation.
   void handle_connect_check(const boost::system::error_code& e,
       boost::asio::ip::tcp::resolver::iterator endpoint_iterator);
+
+  /// Handle completion of a GetResults operation.
+  void handle_connect_get(const boost::system::error_code& e,
+      boost::asio::ip::tcp::resolver::iterator endpoint_iterator);
+
+  /// Handle completion of an operation.
+  void handle_FinishOperation(const boost::system::error_code& e);
 
   /// Callback function when bunch of jobs have been sent.
@@ -50,4 +57,10 @@
   /// Callback function when doneJobs have been received.
   void handle_ReceiveDoneJobs(const boost::system::error_code& e);
+
+  /// Callback function when results are about to be received.
+  void handle_ReceivingResults(const boost::system::error_code& e);
+
+  /// Callback function when results have been received.
+  void handle_ReceivedResults(const boost::system::error_code& e);
 
   /// place number of jobs into this controller
@@ -68,4 +81,10 @@
   }
 
+  /// prepares the receival of the results
+  void obtainResults();
+
+  /// get the results for the current jobs
+  std::vector<FragmentResult> getResults();
+
   /// get the number of finished results for the current jobs
   void checkResults();
@@ -78,9 +97,12 @@
   boost::asio::ip::tcp::resolver::iterator getEndpointIterator();
 
-  /// internal function to connect to server and send jobs for calculating jobs
+  /// internal function to connect to server and send jobs for calculation
   void connect_calc();
 
-  /// internal function to connect to server and send jobs for checking donejobs
+  /// internal function to connect to server and check done jobs
   void connect_check();
+
+  /// internal function to connect to server and receive calculated results
+  void connect_get();
 
   /// internal function to disconnect from server
@@ -103,4 +125,7 @@
   enum Exitflag_t Exitflag;
 
+  /// bunch of results
+  std::vector<FragmentResult> results;
+
   /// currently calculated results
   size_t doneJobs;
Index: src/Fragmentation/Automation/FragmentScheduler.cpp
===================================================================
--- src/Fragmentation/Automation/FragmentScheduler.cpp	(revision b9c48666be399d007fd031b2d636eba8227f227d)
+++ src/Fragmentation/Automation/FragmentScheduler.cpp	(revision e70b9dc00a22a0801131763acf7c71937581ac4d)
@@ -57,11 +57,17 @@
   ),
   result(JobId::NoJob),
+  choice(NoOperation),
   Exitflag(OkFlag)
 {
   Info info(__FUNCTION__);
 
-  initiateWorkerSocket();
+  // only initiate socket if jobs are already present
+  if (JobsQueue.isJobPresent()) {
+    LOG(1, "Listening for workers on port " << workerport << ".");
+    initiateWorkerSocket();
+  }
 
   initiateControllerSocket();
+  LOG(1, "Listening for controller on port " << controllerport << ".");
 }
 
@@ -117,7 +123,4 @@
         boost::asio::placeholders::error, conn));
 
-      // Start an accept operation for a new Connection only when there
-      // are still jobs present otherwise we quit.
-      initiateWorkerSocket();
     } else {
       // send the static NoJob
@@ -139,4 +142,9 @@
     ELOG(0, e.message());
   }
+
+  // Start an accept operation for a new Connection only when there
+  // are still jobs present
+  if (JobsQueue.isJobPresent())
+    initiateWorkerSocket();
 }
 
@@ -169,15 +177,15 @@
 {
   Info info(__FUNCTION__);
-  // nothing to do
   LOG(1, "INFO: Received result for job #" << result.getId() << " ...");
-  // and push into queue
   ASSERT(result.getId() != (JobId_t)JobId::NoJob,
       "FragmentScheduler::handle_ReceiveResultFromWorker() - result received has NoJob id.");
   ASSERT(result.getId() != (JobId_t)JobId::IllegalJob,
       "FragmentScheduler::handle_ReceiveResultFromWorker() - result received has IllegalJob id.");
+  // place id into expected
   if ((result.getId() != (JobId_t)JobId::NoJob) && (result.getId() != (JobId_t)JobId::IllegalJob))
     JobsQueue.pushResult(result);
   // erase result
   result = FragmentResult(JobId::NoJob);
+  LOG(1, "INFO: JobsQueue has " << JobsQueue.getDoneJobs() << " results.");
 }
 
@@ -196,21 +204,7 @@
   if (!e)
   {
-    if (JobsQueue.isJobPresent() || !JobsQueue.getDoneJobs()) {
-      // The connection::async_write() function will automatically
-      // serialize the data structure for us.
-      LOG(1, "INFO: Receiving bunch of jobs from a controller ...");
-      conn->async_read(jobs,
-        boost::bind(&FragmentScheduler::handle_ReceiveJobs, this,
-        boost::asio::placeholders::error, conn));
-    } else {
-      // we just give a status report ...
-      // first update number
-      doneJobs = JobsQueue.getDoneJobs();
-      // now we accept connections to check for state of calculations
-      LOG(1, "INFO: Sending state of results to controller ...");
-      conn->async_write(doneJobs,
-        boost::bind(&FragmentScheduler::handle_CheckResultState, this,
-        boost::asio::placeholders::error, conn));
-    }
+    conn->async_read(choice,
+      boost::bind(&FragmentScheduler::handle_ReadChoice, this,
+      boost::asio::placeholders::error, conn));
   }
   else
@@ -224,6 +218,81 @@
 }
 
+/** Controller callback function to read the choice for next operation.
+ *
+ * \param e error code if something went wrong
+ * \param conn reference with the connection
+ */
+void FragmentScheduler::handle_ReadChoice(const boost::system::error_code& e, connection_ptr conn)
+{
+  Info info(__FUNCTION__);
+  if (!e)
+  {
+    // switch over the desired choice read previously
+    switch(choice) {
+    case NoOperation:
+    {
+      ELOG(1, "FragmentScheduler::handle_ReadChoice() - called with NoOperation.");
+      break;
+    }
+    case ReceiveJobs:
+      {
+        // The connection::async_write() function will automatically
+        // serialize the data structure for us.
+        LOG(1, "INFO: Receiving bunch of jobs from a controller ...");
+        conn->async_read(jobs,
+          boost::bind(&FragmentScheduler::handle_ReceiveJobs, this,
+          boost::asio::placeholders::error, conn));
+        break;
+      }
+    case CheckState:
+    {
+      // first update number
+      doneJobs = JobsQueue.getDoneJobs();
+      // now we accept connections to check for state of calculations
+      LOG(1, "INFO: Sending state that "+toString(doneJobs)+" jobs are done to controller ...");
+      conn->async_write(doneJobs,
+        boost::bind(&FragmentScheduler::handle_CheckResultState, this,
+        boost::asio::placeholders::error, conn));
+
+      initiateControllerSocket();
+      break;
+    }
+    case SendResults:
+    {
+      const std::vector<FragmentResult> results = JobsQueue.getAllResults();
+      // ... or we give the results
+      LOG(1, "INFO: Sending "+toString(results.size())+" results to controller ...");
+      conn->async_write(results,
+        boost::bind(&FragmentScheduler::handle_SendResults, this,
+        boost::asio::placeholders::error, conn));
+
+      initiateControllerSocket();
+      break;
+    }
+    default:
+      Exitflag = ControllerErrorFlag;
+      ELOG(1, "FragmentScheduler::handle_ReadChoice() - called with no valid choice.");
+      break;
+    }
+    // restore NoOperation choice such that choice is not read twice
+    choice = NoOperation;
+
+  }
+  else
+  {
+    // An error occurred. Log it and return. Since we are not starting a new
+    // accept operation the io_service will run out of work to do and the
+    // server will exit.
+    Exitflag = ControllerErrorFlag;
+    ELOG(0, e.message());
+  }
+}
+
 /** Controller callback function when job has been sent.
  *
+ * We check here whether the worker socket is accepting, if there
+ * have been no jobs we re-activate it, as it is shut down after
+ * last job.
+ *
  * \param e error code if something went wrong
  * \param conn reference with the connection
@@ -232,12 +301,14 @@
 {
   Info info(__FUNCTION__);
+  bool initiateSocket = !JobsQueue.isJobPresent();
+
   // jobs are received, hence place in JobsQueue
   if (!jobs.empty()) {
     LOG(1, "INFO: Pushing " << jobs.size() << " jobs into queue.");
     JobsQueue.pushJobs(jobs);
-  }
-  // launch new acceptor of queue has been filled/is full
-  if (JobsQueue.isJobPresent()) {
-    // Start an accept operation for a new Connection.
+    // initiate socket if we had no jobs before
+    if (initiateSocket)
+      initiateWorkerSocket();
+    // launch new acceptor of queue has been filled/is full
     initiateControllerSocket();
   } else {
@@ -246,4 +317,5 @@
 
   jobs.clear();
+
 }
 
@@ -259,2 +331,15 @@
   LOG(1, "INFO: Sent that " << doneJobs << " jobs are done.");
 }
+
+/** Controller callback function when result has been received.
+ *
+ * \param e error code if something went wrong
+ * \param conn reference with the connection
+ */
+void FragmentScheduler::handle_SendResults(const boost::system::error_code& e, connection_ptr conn)
+{
+  Info info(__FUNCTION__);
+  // do nothing
+  LOG(1, "INFO: Results have been sent.");
+}
+
Index: src/Fragmentation/Automation/FragmentScheduler.hpp
===================================================================
--- src/Fragmentation/Automation/FragmentScheduler.hpp	(revision b9c48666be399d007fd031b2d636eba8227f227d)
+++ src/Fragmentation/Automation/FragmentScheduler.hpp	(revision e70b9dc00a22a0801131763acf7c71937581ac4d)
@@ -21,4 +21,6 @@
 #include "FragmentQueue.hpp"
 #include "FragmentResult.hpp"
+#include "ControllerChoices.hpp"
+#include "types.hpp"
 
 /** FragmentScheduler serves FragmentJobs to Workers.
@@ -34,4 +36,5 @@
   enum Exitflag_t{
     OkFlag = 0,
+    QueueError = 128,
     ControllerErrorFlag = 254,
     WorkerErrorFlag = 255
@@ -54,4 +57,7 @@
   void handle_AcceptController(const boost::system::error_code& e, connection_ptr conn);
 
+  /// Handle completion of controller operation to read choice
+  void handle_ReadChoice(const boost::system::error_code& e, connection_ptr conn);
+
   /// Worker callback function when job has been sent.
   void handle_SendJobtoWorker(const boost::system::error_code& e, connection_ptr conn);
@@ -67,4 +73,7 @@
   /// Controller callback function when checking on state of results.
   void handle_CheckResultState(const boost::system::error_code& e, connection_ptr conn);
+
+  /// Controller callback function when result has been received.
+  void handle_SendResults(const boost::system::error_code& e, connection_ptr conn);
 
   /// internal function to prepare worker connections
@@ -90,4 +99,7 @@
   size_t doneJobs;
 
+  // choice
+  enum ControllerChoices choice;
+
   /// Queue with data to be sent to each client.
   FragmentQueue JobsQueue;
Index: src/Fragmentation/Automation/Makefile.am
===================================================================
--- src/Fragmentation/Automation/Makefile.am	(revision b9c48666be399d007fd031b2d636eba8227f227d)
+++ src/Fragmentation/Automation/Makefile.am	(revision e70b9dc00a22a0801131763acf7c71937581ac4d)
@@ -45,5 +45,5 @@
 AM_CPPFLAGS = ${BOOST_CPPFLAGS} ${CodePatterns_CFLAGS}
 
-bin_PROGRAMS += JobAdder ResultChecker Server Worker
+bin_PROGRAMS += JobAdder ResultChecker ResultGetter Server Worker
 
 CONTROLLERSOURCE = \
@@ -52,4 +52,5 @@
 CONTROLLERHEADER = \
   Connection.hpp \
+  ControllerChoices.hpp \
   FragmentController.hpp
 
@@ -59,4 +60,5 @@
 SERVERHEADER = \
   Connection.hpp \
+  ControllerChoices.hpp \
   FragmentScheduler.hpp
 
@@ -93,4 +95,16 @@
   ${CodePatterns_LIBS}
 
+ResultGetter_SOURCES = $(CONTROLLERSOURCE) $(CONTROLLERHEADER) ResultGetter.cpp
+ResultGetter_LDFLAGS = $(AM_LDFLAGS) $(BOOST_ASIO_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS) $(BOOST_THREAD_LDFLAGS) $(BOOST_SERIALIZATION_LDFLAGS)
+ResultGetter_CXXFLAGS = $(AM_CPPFLAGS)
+ResultGetter_LDADD = \
+  libMolecuilderFragmentJobs.la \
+  libMolecuilderFragmentationAutomation.la \
+  $(BOOST_ASIO_LIBS) \
+  $(BOOST_SERIALIZATION_LIBS) \
+  $(BOOST_THREAD_LIBS) \
+  $(BOOST_SYSTEM_LIBS) \
+  ${CodePatterns_LIBS}
+
 Server_SOURCES = $(SERVERSOURCE) $(SERVERHEADER) Server.cpp
 Server_LDFLAGS = $(AM_LDFLAGS) $(BOOST_ASIO_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS) $(BOOST_THREAD_LDFLAGS) $(BOOST_SERIALIZATION_LDFLAGS)
Index: src/Fragmentation/Automation/ResultGetter.cpp
===================================================================
--- src/Fragmentation/Automation/ResultGetter.cpp	(revision e70b9dc00a22a0801131763acf7c71937581ac4d)
+++ src/Fragmentation/Automation/ResultGetter.cpp	(revision e70b9dc00a22a0801131763acf7c71937581ac4d)
@@ -0,0 +1,86 @@
+/*
+ * 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 "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, argv[1], argv[2]);
+
+    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.obtainResults();
+    {
+      Info info("io_service");
+      io_service.run();
+    }
+    std::vector<FragmentResult> results = controller.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: src/Fragmentation/Automation/Server.cpp
===================================================================
--- src/Fragmentation/Automation/Server.cpp	(revision b9c48666be399d007fd031b2d636eba8227f227d)
+++ src/Fragmentation/Automation/Server.cpp	(revision e70b9dc00a22a0801131763acf7c71937581ac4d)
@@ -53,7 +53,5 @@
     }
     unsigned short workerport = boost::lexical_cast<unsigned short>(argv[1]);
-    std::cout << "Listening for workers on port " << workerport << "." << std::endl;
     unsigned short controllerport = boost::lexical_cast<unsigned short>(argv[2]);
-    std::cout << "Listening for controller on port " << controllerport << "." << std::endl;
 
     boost::asio::io_service io_service;
Index: src/Fragmentation/Automation/types.hpp
===================================================================
--- src/Fragmentation/Automation/types.hpp	(revision b9c48666be399d007fd031b2d636eba8227f227d)
+++ src/Fragmentation/Automation/types.hpp	(revision e70b9dc00a22a0801131763acf7c71937581ac4d)
@@ -14,4 +14,5 @@
 #endif
 
+//!> type for ids of jobs
 typedef size_t JobId_t;
 
