Index: src/Actions/pyMoleCuilder.cpp
===================================================================
--- src/Actions/pyMoleCuilder.cpp	(revision b5d38d24f005e657e47a9754b47a4696cb55a7ff)
+++ src/Actions/pyMoleCuilder.cpp	(revision 567357327df58f213deda25db79a4a8e493bf567)
@@ -32,5 +32,35 @@
 #include "cleanUp.hpp"
 #include "Actions/ActionHistory.hpp"
+#include "cleanUp.hpp"
 
+namespace MoleCuilder {
+
+namespace detail {
+
+void module_exit()
+{
+  // save everything
+  std::cout << "Saving." << std::endl;
+  saveAll();
+  // purge everything
+  std::cout << "Cleaning memory." << std::endl;
+  cleanUp();
+}
+
+void module_reinit()
+{
+  // save everything
+  std::cout << "Saving." << std::endl;
+  saveAll();
+  // purge everything
+  std::cout << "Cleaning static instances from memory." << std::endl;
+  purgeStaticInstances();
+  // need to init the history before any action is created
+  std::cout << "Reinitializing." << std::endl;
+  MoleCuilder::ActionHistory::init();
+}
+
+} /* namespace MoleCuilder */
+} /* namespace detail */
 
 BOOST_PYTHON_MODULE(pyMoleCuilder)
@@ -41,9 +71,10 @@
   // from this moment on, we need to be sure to deeinitialize in the correct order
   // this is handled by the cleanup function
-  atexit(cleanUp);
+  atexit(MoleCuilder::detail::module_exit);
 
   // set the docstring of the current module scope
   boost::python::scope().attr("__doc__") = "pyMolecuilder are the python bindings to all Actions of the program suite MoleCuilder.\n\nMoleCuilder is a program to build molecular (dynamics) worlds, allowing you indefinite manipulation, control and analysis over the atoms and molecules within a simulation domain.";
 
+  boost::python::def("reinit", MoleCuilder::detail::module_reinit, "Reinitializes the internal state of the python module as if it had been freshly imported, saves all input files beforehand.");
 #define export_print(z,n,list) \
 	BOOST_PP_CAT(export_, BOOST_PP_SEQ_ELEM(n, list))();
Index: src/cleanUp.cpp
===================================================================
--- src/cleanUp.cpp	(revision b5d38d24f005e657e47a9754b47a4696cb55a7ff)
+++ src/cleanUp.cpp	(revision 567357327df58f213deda25db79a4a8e493bf567)
@@ -62,14 +62,10 @@
 }
 
-/** Cleans all singleton instances in an orderly fashion.
- * C++ does not guarantee any specific sequence of removal of single instances
- * which have static/global variables. Some singletons depend on others hence we
- * acertain a specific ordering here, which is is used via the atexit() hook.
+/** purges all static (singleton) instances in correct order of dependency.
+ *
  */
-void cleanUp()
+void purgeStaticInstances()
 {
-  printTimings();
   Chronos::purgeInstance();
-
   RandomNumberDistributionFactory::purgeInstance();
   RandomNumberEngineFactory::purgeInstance();
@@ -85,4 +81,19 @@
   MoleCuilder::OptionRegistry::purgeInstance();
   MoleCuilder::ActionHistory::purgeInstance();
+  logger::purgeInstance();
+  errorLogger::purgeInstance();
+}
+
+/** Cleans all singleton instances in an orderly fashion.
+ * C++ does not guarantee any specific sequence of removal of single instances
+ * which have static/global variables. Some singletons depend on others hence we
+ * acertain a specific ordering here, which is is used via the atexit() hook.
+ */
+void cleanUp()
+{
+  // give timings per Action
+  printTimings();
+  // purge static instances from memory
+  purgeStaticInstances(); 
   // we have to remove these two static as otherwise their boost::shared_ptrs are still present
   MoleCuilder::Action::removeStaticStateEntities();
@@ -90,6 +101,4 @@
   // admonishing lateron
   AddStaticEntitiestoIgnoreList();
-  logger::purgeInstance();
-  errorLogger::purgeInstance();
 #ifdef LOG_OBSERVER
   cout << observerLog().getLog();
Index: src/cleanUp.hpp
===================================================================
--- src/cleanUp.hpp	(revision b5d38d24f005e657e47a9754b47a4696cb55a7ff)
+++ src/cleanUp.hpp	(revision 567357327df58f213deda25db79a4a8e493bf567)
@@ -18,4 +18,5 @@
 void dumpMemory();
 void printTimings();
+void purgeStaticInstances();
 int saveAll();
 
