Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(revision 5fa1f0d91ec5fcecb8e7f01bba8935242d296f10)
+++ src/Makefile.am	(revision 6c52d21071940cf6fad648f37d1ea0b21900a409)
@@ -398,7 +398,7 @@
   ${CodePatterns_LIBS}
 
-PoolWorker_SOURCES = $(POOLWORKERSOURCE) $(POOLWORKERHEADER) poolworker.cpp
-PoolWorker_LDFLAGS = $(AM_LDFLAGS) $(BOOST_ASIO_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS) $(BOOST_THREAD_LDFLAGS) $(BOOST_SERIALIZATION_LDFLAGS)
-PoolWorker_CXXFLAGS = $(AM_CPPFLAGS) $(BOOST_ASIO_DEBUG)
+PoolWorker_SOURCES = $(POOLWORKERSOURCE) $(POOLWORKERHEADER) poolworker.cpp DefaultOptions.cpp DefaultOptions.hpp SignalOptions.cpp SignalOptions.hpp WorkerOptions.cpp WorkerOptions.hpp
+PoolWorker_LDFLAGS = $(AM_LDFLAGS) $(BOOST_PROGRAM__OPTIONS_LDFLAGS) $(BOOST_SYSTEM_LDFLAGS) $(BOOST_THREAD_LDFLAGS)
+PoolWorker_CXXFLAGS = $(AM_CPPFLAGS)
 PoolWorker_LDADD = \
   libMolecuilderJobs.la \
Index: src/SignalOptions.cpp
===================================================================
--- src/SignalOptions.cpp	(revision 6c52d21071940cf6fad648f37d1ea0b21900a409)
+++ src/SignalOptions.cpp	(revision 6c52d21071940cf6fad648f37d1ea0b21900a409)
@@ -0,0 +1,34 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2012 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * SignalOptions.cpp
+ *
+ *  Created on: 01.06.2012
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include "SignalOptions.hpp"
+
+#include "CodePatterns/Log.hpp"
+
+int SignalOptions::parseSignals(boost::program_options::variables_map &vm)
+{
+  if (vm.count("signal")) {
+    signals =  vm["signal"].as< std::vector<size_t> >();
+  } else {
+    LOG(0, "STATUS: No signals are caught.");
+  }
+  return 0;
+}
Index: src/SignalOptions.hpp
===================================================================
--- src/SignalOptions.hpp	(revision 6c52d21071940cf6fad648f37d1ea0b21900a409)
+++ src/SignalOptions.hpp	(revision 6c52d21071940cf6fad648f37d1ea0b21900a409)
@@ -0,0 +1,25 @@
+/*
+ * SignalOptions.hpp
+ *
+ *  Created on: 01.06.2012
+ *      Author: heber
+ */
+
+#ifndef SIGNALOPTIONS_HPP_
+#define SIGNALOPTIONS_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <boost/program_options.hpp>
+#include <vector>
+
+struct SignalOptions {
+  int parseSignals(boost::program_options::variables_map &vm);
+
+  std::vector<size_t> signals;
+};
+
+#endif /* SIGNALOPTIONS_HPP_ */
Index: src/WorkerOptions.cpp
===================================================================
--- src/WorkerOptions.cpp	(revision 6c52d21071940cf6fad648f37d1ea0b21900a409)
+++ src/WorkerOptions.cpp	(revision 6c52d21071940cf6fad648f37d1ea0b21900a409)
@@ -0,0 +1,78 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2012 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * WorkerOptions.cpp
+ *
+ *  Created on: 01.06.2012
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include "WorkerOptions.hpp"
+
+#include <unistd.h>
+
+#include "CodePatterns/Log.hpp"
+
+int WorkerOptions::parseServer(boost::program_options::variables_map &vm) {
+  if (vm.count("server")) {
+    server = vm["server"].as< std::string >();
+    serverport = server.substr(server.find_last_of(':')+1, std::string::npos);
+    server = server.substr(0, server.find_last_of(':'));
+    try {
+      boost::lexical_cast<size_t>(serverport);
+    } catch (boost::bad_lexical_cast) {
+      ELOG(1, "Could not interpret " << serverport << " as server:port.");
+      return 255;
+    }
+    LOG(1, "INFO: Using " << server << ":" << serverport << " as server's address.");
+  } else {
+    ELOG(1, "Requiring server's address (host:port) to connect to.");
+    return 255;
+  }
+  return 0;
+}
+
+int WorkerOptions::parseLocalhost(boost::program_options::variables_map &vm) {
+  if (vm.count("hostname")) {
+    hostname = vm["hostname"].as< std::string >();
+    LOG(1, "INFO: Using " << hostname << " as host's name.");
+  } else {
+    char name[1024];
+    if (gethostname(name, 1023) == 0) {
+      hostname = name;
+      LOG(1, "INFO: Using obtained hostname " << hostname << ".");
+    } else {
+      ELOG(1, "No hostname given and failed to determine automatically.");
+      return 255;
+    }
+  }
+  return 0;
+}
+
+int WorkerOptions::parseListenPort(boost::program_options::variables_map &vm) {
+  if (vm.count("listen")) {
+    try {
+      listenport = vm["listen"].as< std::string >();
+    } catch (boost::bad_lexical_cast) {
+      ELOG(1, "Could not read " << vm["listen"].as< std::string >() << " as digits.");
+      return 255;
+    }
+    LOG(1, "INFO: Using port " << listenport << " to listen to server connects.");
+  } else {
+    ELOG(1, "Requiring port to listen on .");
+    return 255;
+  }
+  return 0;
+}
Index: src/WorkerOptions.hpp
===================================================================
--- src/WorkerOptions.hpp	(revision 6c52d21071940cf6fad648f37d1ea0b21900a409)
+++ src/WorkerOptions.hpp	(revision 6c52d21071940cf6fad648f37d1ea0b21900a409)
@@ -0,0 +1,38 @@
+/*
+ * WorkerOptions.hpp
+ *
+ *  Created on: 01.06.2012
+ *      Author: heber
+ */
+
+#ifndef WORKEROPTIONS_HPP_
+#define WORKEROPTIONS_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <boost/program_options.hpp>
+#include <string>
+
+#include "DefaultOptions.hpp"
+#include "SignalOptions.hpp"
+
+struct WorkerOptions : public DefaultOptions, public SignalOptions
+{
+  WorkerOptions() :
+    hostname("localhost")
+  {}
+
+  int parseServer(boost::program_options::variables_map &vm);
+  int parseLocalhost(boost::program_options::variables_map &vm);
+  int parseListenPort(boost::program_options::variables_map &vm);
+
+  std::string server;
+  std::string serverport;
+  std::string hostname;
+  std::string listenport;
+};
+
+#endif /* WORKEROPTIONS_HPP_ */
Index: src/poolworker.cpp
===================================================================
--- src/poolworker.cpp	(revision 5fa1f0d91ec5fcecb8e7f01bba8935242d296f10)
+++ src/poolworker.cpp	(revision 6c52d21071940cf6fad648f37d1ea0b21900a409)
@@ -31,5 +31,4 @@
 #include <boost/lexical_cast.hpp>
 #include <signal.h>
-#include <unistd.h>
 #include <vector>
 
@@ -37,5 +36,8 @@
 #include "CodePatterns/Info.hpp"
 #include "CodePatterns/Log.hpp"
-#include "Fragmentation/Automation/Pool/PoolWorker.hpp"
+#include "Pool/PoolWorker.hpp"
+#include "atexit.hpp"
+#include "Jobs/SystemCommandJob.hpp"
+#include "WorkerOptions.hpp"
 
 //!> global shutdown function
@@ -65,4 +67,5 @@
 }
 
+
 int main(int argc, char* argv[])
 {
@@ -70,4 +73,7 @@
   // this is handled by the cleanup function
   atexit(cleanUp);
+
+  WorkerOptions WorkerOpts;
+  boost::program_options::variables_map vm;
 
   // Declare the supported options.
@@ -82,67 +88,21 @@
   ;
 
-  boost::program_options::variables_map vm;
   boost::program_options::store(boost::program_options::parse_command_line(argc, argv, desc), vm);
   boost::program_options::notify(vm);
 
-  if (vm.count("help")) {
-    std::cout << desc << "\n";
-    return 1;
-  }
-
-  if (vm.count("verbosity")) {
-    LOG(0, "STATUS: Verbosity level was set to " << vm["verbosity"].as<size_t>() << ".");
-    setVerbosity(vm["verbosity"].as<size_t>());
-  } else {
-    LOG(0, "STATUS: Verbosity level was not set, defaulting to 5.");
-    setVerbosity(5);
-  }
-
-  std::string server;
-  std::string serverport;
-  if (vm.count("server")) {
-    server = vm["server"].as< std::string >();
-    serverport = server.substr(server.find_last_of(':')+1, std::string::npos);
-    server = server.substr(0, server.find_last_of(':'));
-    try {
-      boost::lexical_cast<size_t>(serverport);
-    } catch (boost::bad_lexical_cast) {
-      ELOG(1, "Could not interpret " << serverport << " as server:port.");
-      return 255;
-    }
-    LOG(1, "INFO: Using " << server << ":" << serverport << " as server's address.");
-  } else {
-    ELOG(1, "Requiring server's address (host:port) to connect to.");
-    return 255;
-  }
-
-  std::string hostname("localhost");
-  if (vm.count("hostname")) {
-    hostname = vm["hostname"].as< std::string >();
-    LOG(1, "INFO: Using " << hostname << " as host's name.");
-  } else {
-    char name[1024];
-    if (gethostname(name, 1023) == 0) {
-      hostname = name;
-      LOG(1, "INFO: Using obtained hostname " << hostname << ".");
-    } else {
-      ELOG(1, "No hostname given and failed to determine automatically.");
-      return 255;
-    }
-  }
-
-  std::string listenport;
-  if (vm.count("listen")) {
-    try {
-      listenport = vm["listen"].as< std::string >();
-    } catch (boost::bad_lexical_cast) {
-      ELOG(1, "Could not read " << vm["listen"].as< std::string >() << " as digits.");
-      return 255;
-    }
-    LOG(1, "INFO: Using port " << listenport << " to listen to server connects.");
-  } else {
-    ELOG(1, "Requiring port to listen on .");
-    return 255;
-  }
+  int status = 0;
+  if (status) return status;
+  status = WorkerOpts.parseHelp(vm, desc);
+  if (status) return status;
+  status = WorkerOpts.parseVerbosity(vm);
+  if (status) return status;
+  status = WorkerOpts.parseServer(vm);
+  if (status) return status;
+  status = WorkerOpts.parseListenPort(vm);
+  if (status) return status;
+  status = WorkerOpts.parseLocalhost(vm);
+  if (status) return status;
+  status = WorkerOpts.parseSignals(vm);
+  if (status) return status;
 
   size_t exitflag = 0;
@@ -150,17 +110,12 @@
   {
     boost::asio::io_service io_service;
-    PoolWorker client(io_service, server, serverport, hostname, listenport);
+    PoolWorker client(io_service, WorkerOpts.server, WorkerOpts.serverport, WorkerOpts.hostname, WorkerOpts.listenport);
 
     // catch ctrl-c and shutdown worker properly
     shutdownfunction = boost::bind(&PoolWorker::shutdown, boost::ref(client), _1);
-    if (vm.count("signal")) {
-      signals =  vm["signal"].as< std::vector<size_t> >();
-      for (std::vector<size_t>::const_iterator iter = signals.begin();
-          iter != signals.end(); ++iter) {
-        LOG(0, "STATUS: Catching signal " << *iter << " via signal handler.");
-        signal(*iter, &signalhandler);
-      }
-    } else {
-      LOG(0, "STATUS: No signals are caught.");
+    for (std::vector<size_t>::const_iterator iter = WorkerOpts.signals.begin();
+        iter != WorkerOpts.signals.end(); ++iter) {
+      LOG(0, "STATUS: Catching signal " << *iter << " via signal handler.");
+      signal(*iter, &signalhandler);
     }
 
