Index: /code/branches/merge/src/core/BaseObject.cc
===================================================================
--- /code/branches/merge/src/core/BaseObject.cc	(revision 1262)
+++ /code/branches/merge/src/core/BaseObject.cc	(revision 1263)
@@ -45,12 +45,11 @@
         @brief Constructor: Registers the object in the BaseObject-list.
     */
-    BaseObject::BaseObject()
+    BaseObject::BaseObject() :
+      bActive_(true),
+      bVisible_(true),
+      level_(0),
+      namespace_(0)
     {
         RegisterRootObject(BaseObject);
-
-        this->bActive_ = true;
-        this->bVisible_ = true;
-        this->level_ = 0;
-        this->namespace_ = 0;
     }
 
Index: /code/branches/merge/src/core/CoreIncludes.h
===================================================================
--- /code/branches/merge/src/core/CoreIncludes.h	(revision 1262)
+++ /code/branches/merge/src/core/CoreIncludes.h	(revision 1263)
@@ -59,5 +59,7 @@
     if (orxonox::Identifier::isCreatingHierarchy() && this->getParents()) \
         this->getParents()->insert(this->getParents()->end(), this->getIdentifier()); \
-    orxonox::ClassManager<ClassName>::getIdentifier()->addObject(this)
+    orxonox::ClassManager<ClassName>::getIdentifier()->addObject(this); \
+    if (orxonox::Identifier::isCreatingHierarchy()) \
+      return
 
 /**
Index: /code/branches/merge/src/core/Debug.h
===================================================================
--- /code/branches/merge/src/core/Debug.h	(revision 1262)
+++ /code/branches/merge/src/core/Debug.h	(revision 1263)
@@ -273,5 +273,5 @@
 #define CCOUT_EXEC(x) \
   orxonox::OutputHandler::getOutStream().setOutputLevel(x) \
-  << "*** " << this->getIdentifier()->getName() << ": "
+  << this->getIdentifier()->getName() << ": "
 
 #ifndef CCOUT
Index: /code/branches/merge/src/core/Error.cc
===================================================================
--- /code/branches/merge/src/core/Error.cc	(revision 1262)
+++ /code/branches/merge/src/core/Error.cc	(revision 1263)
@@ -37,15 +37,5 @@
 namespace orxonox
 {
-	Error::Error()
-	{
-		Error(0,"");
-	}
-
 	Error::Error(std::string errorMsg, int errorCode)
-	{
-		Error(errorCode, errorMsg);
-	}
-
-	Error::Error(int errorCode, std::string errorMsg)
 	{
 		COUT(1) << "############################ "<< std::endl
Index: /code/branches/merge/src/core/Error.h
===================================================================
--- /code/branches/merge/src/core/Error.h	(revision 1262)
+++ /code/branches/merge/src/core/Error.h	(revision 1263)
@@ -44,7 +44,5 @@
 	{
 	public:
-		Error();
-		Error(std::string errorMsg, int errorCode = 0);
-		Error(int errorCode, std::string errorMsg = "");
+		Error(std::string errorMsg = "", int errorCode = 0);
 	private:
 
Index: /code/branches/merge/src/core/Namespace.cc
===================================================================
--- /code/branches/merge/src/core/Namespace.cc	(revision 1262)
+++ /code/branches/merge/src/core/Namespace.cc	(revision 1263)
@@ -37,11 +37,10 @@
     CreateFactory(Namespace);
 
-    Namespace::Namespace()
+    Namespace::Namespace() :
+      bAutogeneratedFileRootNamespace_(false),
+      bRoot_(false),
+      operator_("or")
     {
         RegisterObject(Namespace);
-
-        this->bAutogeneratedFileRootNamespace_ = false;
-        this->bRoot_ = false;
-        this->operator_ = "or";
     }
 
Index: /code/branches/merge/src/core/OrxonoxClass.cc
===================================================================
--- /code/branches/merge/src/core/OrxonoxClass.cc	(revision 1262)
+++ /code/branches/merge/src/core/OrxonoxClass.cc	(revision 1263)
@@ -37,10 +37,9 @@
 {
     /** @brief Constructor: Sets the default values. */
-    OrxonoxClass::OrxonoxClass()
+    OrxonoxClass::OrxonoxClass() :
+      identifier_(0),
+      parents_(0)
     {
         this->setConfigValues();
-
-        this->identifier_ = 0;
-        this->parents_ = 0;
     }
 
Index: /code/branches/merge/src/orxonox/GraphicsEngine.cc
===================================================================
--- /code/branches/merge/src/orxonox/GraphicsEngine.cc	(revision 1262)
+++ /code/branches/merge/src/orxonox/GraphicsEngine.cc	(revision 1263)
@@ -44,5 +44,5 @@
 #include "core/ConfigValueIncludes.h"
 #include "core/Debug.h"
-#include "core/TclBind.h"
+#include "core/CommandExecutor.h"
 
 
@@ -53,5 +53,5 @@
     @return The only instance of GraphicsEngine.
   */
-  GraphicsEngine& GraphicsEngine::getSingleton()
+  /*static*/ GraphicsEngine& GraphicsEngine::getSingleton()
   {
     static GraphicsEngine theOnlyInstance;
@@ -62,15 +62,25 @@
     @brief Only use constructor to initialise variables and pointers!
   */
-  GraphicsEngine::GraphicsEngine()
+  GraphicsEngine::GraphicsEngine() :
+    root_(0),
+    scene_(0),
+    renderWindow_(0),
+    //configPath_(""),
+    dataPath_(""),
+    ogreLogfile_("")
   {
     RegisterObject(GraphicsEngine);
-    //this->bOverwritePath_ = false;
+
     this->setConfigValues();
-    // set to standard values
-    this->configPath_ = "";
-    this->root_ = 0;
-    this->scene_ = 0;
-    this->renderWindow_ = 0;
-    COUT(4) << "*** GraphicsEngine: Constructed" << std::endl;
+    CCOUT(4) << "Constructed" << std::endl;
+  }
+
+  void GraphicsEngine::setConfigValues()
+  {
+    SetConfigValue(dataPath_, "../../Media/").description("relative path to media data");
+    SetConfigValue(ogreLogfile_, "ogre.log").description("Logfile for messages from Ogre. Use \"\" to suppress log file creation.");
+    SetConfigValue(ogreLogLevelTrivial_ , 5).description("Corresponding orxonox debug level for ogre Trivial");
+    SetConfigValue(ogreLogLevelNormal_  , 4).description("Corresponding orxonox debug level for ogre Normal");
+    SetConfigValue(ogreLogLevelCritical_, 2).description("Corresponding orxonox debug level for ogre Critical");
   }
 
@@ -89,5 +99,5 @@
   void GraphicsEngine::destroy()
   {
-    COUT(4) << "*** GraphicsEngine: Destroying objects..." << std::endl;
+    COUT(4) << "Destroying objects..." << std::endl;
     Ogre::WindowEventUtilities::removeWindowEventListener(this->renderWindow_, this);
     if (this->root_)
@@ -103,16 +113,5 @@
       delete Ogre::LogManager::getSingletonPtr();
     }
-    COUT(4) << "*** GraphicsEngine: Destroying objects done" << std::endl;
-  }
-
-  void GraphicsEngine::setConfigValues()
-  {
-    SetConfigValue(dataPath_, "../../Media/").description("relative path to media data");
-    SetConfigValue(ogreLogfile_, "ogre.log").description("Logfile for messages from Ogre. Use \"\" to suppress log file creation.");
-    SetConfigValue(ogreLogLevelTrivial_ , 5).description("Corresponding orxonox debug level for ogre Trivial");
-    SetConfigValue(ogreLogLevelNormal_  , 4).description("Corresponding orxonox debug level for ogre Normal");
-    SetConfigValue(ogreLogLevelCritical_, 2).description("Corresponding orxonox debug level for ogre Critical");
-
-    TclBind::getInstance().setDataPath(this->dataPath_);
+    COUT(4) << "Destroying objects done" << std::endl;
   }
 
@@ -120,13 +119,16 @@
     @brief Creates the Ogre Root object and sets up the ogre log.
   */
-  void GraphicsEngine::setup()
-  {
+  bool GraphicsEngine::setup(std::string& dataPath)
+  {
+    CCOUT(3) << "Setting up..." << std::endl;
+    // temporary overwrite of dataPath, change ini file for permanent change
+    if (dataPath != "")
+      dataPath_ = dataPath;
+    if (dataPath_ == "")
+      return false;
+    if (dataPath_[dataPath_.size() - 1] != '/')
+      dataPath_ += "/";
+
     //TODO: Check if file exists (maybe not here)
-/*#ifndef OGRE_STATIC_LIB
-    root_ = new Ogre::Root(configPath_ + "plugins.cfg", configPath_ + "ogre.cfg",
-                     configPath_ + "Ogre.log");
-#else
-    root_ = new Ogre::Root(NULL, configPath_ + "ogre.cfg", configPath_ + "Ogre.log");
-#endif*/
 #if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC && defined(_DEBUG)
     std::string plugin_filename = "plugins_d.cfg";
@@ -137,9 +139,9 @@
     // create a logManager
     Ogre::LogManager *logger;
-		if (Ogre::LogManager::getSingletonPtr() == 0)
-			logger = new Ogre::LogManager();
+    if (Ogre::LogManager::getSingletonPtr() == 0)
+      logger = new Ogre::LogManager();
     else
       logger = Ogre::LogManager::getSingletonPtr();
-    COUT(4) << "*** GraphicsEngine: Ogre LogManager created/assigned" << std::endl;
+    CCOUT(4) << "Ogre LogManager created/assigned" << std::endl;
 
     // create our own log that we can listen to
@@ -155,49 +157,23 @@
 
     // Root will detect that we've already created a Log
-    COUT(4) << "*** GraphicsEngine: Creating Ogre Root..." << std::endl;
+    CCOUT(4) << "Creating Ogre Root..." << std::endl;
     root_ = new Ogre::Root(plugin_filename);
-    COUT(4) << "*** GraphicsEngine: Creating Ogre Root done" << std::endl;
-  }
-
-  /**
-   * @return scene manager
-   */
-  Ogre::SceneManager* GraphicsEngine::getSceneManager()
-  {
-    if(!scene_)
-    {
-      scene_ = root_->createSceneManager(Ogre::ST_GENERIC, "Default SceneManager");
-      COUT(3) << "Info: Created SceneMan: " << scene_ << std::endl;
-    }
-    return scene_;
-  }
-
-  bool GraphicsEngine::load(std::string dataPath)
-  {
-    // temporary overwrite of dataPath, change ini file for permanent change
-    if( dataPath != "" )
-      dataPath_ = dataPath + "/";
-    loadRessourceLocations(this->dataPath_);
-    if (!root_->restoreConfig() && !root_->showConfigDialog())
-      return false;
+    CCOUT(4) << "Creating Ogre Root done" << std::endl;
+
+    // specify where Ogre has to look for resources. This call doesn't parse anything yet!
+    declareRessourceLocations();
+
+    CCOUT(3) << "Set up done." << std::endl;
     return true;
   }
 
-  void GraphicsEngine::initialise()
-  {
-    this->renderWindow_ = root_->initialise(true, "OrxonoxV2");
-    Ogre::WindowEventUtilities::addWindowEventListener(this->renderWindow_, this);
-    Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);
-    //TODO: Do NOT load all the groups, why are we doing that? And do we really do that? initialise != load...
-    Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
-  }
-
-  void GraphicsEngine::loadRessourceLocations(std::string dataPath)
-  {
+  void GraphicsEngine::declareRessourceLocations()
+  {
+    CCOUT(4) << "Declaring Resources" << std::endl;
     //TODO: Specify layout of data file and maybe use xml-loader
     //TODO: Work with ressource groups (should be generated by a special loader)
     // Load resource paths from data file using configfile ressource type
     Ogre::ConfigFile cf;
-    cf.load(dataPath + "resources.cfg");
+    cf.load(dataPath_ + "resources.cfg");
 
     // Go through all sections & settings in the file
@@ -216,8 +192,64 @@
 
         Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
-                                           std::string(dataPath + archName),
+                                           std::string(dataPath_ + archName),
                                            typeName, secName);
       }
     }
+  }
+
+  bool GraphicsEngine::loadRenderer()
+  {
+    CCOUT(4) << "Configuring Renderer" << std::endl;
+    if (!root_->restoreConfig() && !root_->showConfigDialog())
+      return false;
+
+    CCOUT(4) << "Creating render window" << std::endl;
+    this->renderWindow_ = root_->initialise(true, "OrxonoxV2");
+    if (!root_->isInitialised())
+    {
+      CCOUT(2) << "Error: Creating Ogre root object failed" << std::endl;
+      return false;
+    }
+    Ogre::WindowEventUtilities::addWindowEventListener(this->renderWindow_, this);
+    Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);
+    return true;
+  }
+
+  bool GraphicsEngine::initialiseResources()
+  {
+    CCOUT(4) << "Initialising resources" << std::endl;
+    //TODO: Do NOT load all the groups, why are we doing that? And do we really do that? initialise != load...
+    try
+    {
+      Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
+      /*Ogre::StringVector str = Ogre::ResourceGroupManager::getSingleton().getResourceGroups();
+      for (unsigned int i = 0; i < str.size(); i++)
+      {
+        Ogre::ResourceGroupManager::getSingleton().loadResourceGroup(str[i]);
+      }*/
+    }
+    catch (Ogre::Exception e)
+    {
+      CCOUT(2) << "Error: There was an Error when initialising the resources." << std::endl;
+      CCOUT(2) << "ErrorMessage: " << e.getFullDescription() << std::endl;
+      return false;
+    }
+    return true;
+  }
+
+  /**
+   * @brief Creates the SceneManager
+   */
+  bool GraphicsEngine::createNewScene()
+  {
+    CCOUT(4) << "Creating new SceneManager" << std::endl;
+    if (scene_)
+    {
+      CCOUT(2) << "SceneManager already exists! Skipping." << std::endl;
+      return false;
+    }
+    scene_ = root_->createSceneManager(Ogre::ST_GENERIC, "Default SceneManager");
+    CCOUT(3) << "Created SceneManager: " << scene_ << std::endl;
+    return true;
   }
 
@@ -291,23 +323,47 @@
     }
     OutputHandler::getOutStream().setOutputLevel(orxonoxLevel)
-        << "*** Ogre: " << message << std::endl;
-  }
-
-    void GraphicsEngine::windowMoved(Ogre::RenderWindow *rw){
-        int w = rw->getWidth();
-        int h = rw->getHeight();
-        InputManager::setWindowExtents(w, h);
-    }
-
-    void GraphicsEngine::windowResized(Ogre::RenderWindow *rw){
-        int w = rw->getWidth();
-        int h = rw->getHeight();
-        InputManager::setWindowExtents(w, h);
-    }
-
-    void GraphicsEngine::windowFocusChanged(Ogre::RenderWindow *rw){
-        int w = rw->getWidth();
-        int h = rw->getHeight();
-        InputManager::setWindowExtents(w, h);
-    }
+        << "Ogre: " << message << std::endl;
+  }
+
+  /**
+  * Window has resized.
+  * @param rw The render window it occured in
+  */
+  void GraphicsEngine::windowMoved(Ogre::RenderWindow *rw)
+  {
+    // note: this doesn't change the window extents
+  }
+
+  /**
+  * Window has resized.
+  * @param rw The render window it occured in
+  * @note GraphicsEngine has a render window stored itself. This is the same
+  *       as rw. But we have to be careful when using multiple render windows!
+  */
+  void GraphicsEngine::windowResized(Ogre::RenderWindow *rw)
+  {
+    // change the mouse clipping size for absolute mouse movements
+    int w = rw->getWidth();
+    int h = rw->getHeight();
+    InputManager::setWindowExtents(w, h);
+  }
+
+  /**
+  * Window has resized.
+  * @param rw The render window it occured in
+  */
+  void GraphicsEngine::windowFocusChanged(Ogre::RenderWindow *rw)
+  {
+    // note: this doesn't change the window extents
+  }
+
+  /**
+  * Window has resized.
+  * @param rw The render window it occured in
+  */
+  void GraphicsEngine::windowClosed(Ogre::RenderWindow *rw)
+  {
+    // using CommandExecutor in order to avoid depending on Orxonox class.
+    CommandExecutor::execute("exit", false);
+  }
 }
Index: /code/branches/merge/src/orxonox/GraphicsEngine.h
===================================================================
--- /code/branches/merge/src/orxonox/GraphicsEngine.h	(revision 1262)
+++ /code/branches/merge/src/orxonox/GraphicsEngine.h	(revision 1263)
@@ -52,16 +52,18 @@
     @brief Graphics engine manager class
     */
-    class _OrxonoxExport GraphicsEngine : public Ogre::WindowEventListener, public OrxonoxClass, public Ogre::LogListener
+    class _OrxonoxExport GraphicsEngine : public Ogre::WindowEventListener, public Ogre::LogListener, public OrxonoxClass
     {
-        friend class ClassIdentifier<GraphicsEngine>;
         public:
-            void setConfigPath(std::string path) { this->configPath_ = path; };
             void setConfigValues();
-            void setup();
-            bool load(std::string path);
-            void loadRessourceLocations(std::string path);
-            Ogre::SceneManager* getSceneManager();
-            void initialise();
+            bool setup(std::string& dataPath);
+            void declareRessourceLocations();
+            bool loadRenderer();
+            bool initialiseResources();
+            bool createNewScene();
+
             void destroy();
+
+            Ogre::SceneManager* getSceneManager() { return scene_; }
+            std::string& getDataPath() { return dataPath_; }
 
             // several window properties
@@ -71,10 +73,11 @@
             int getWindowHeight() const;
 
+            void windowMoved       (Ogre::RenderWindow* rw);
+            void windowResized     (Ogre::RenderWindow* rw);
+            void windowFocusChanged(Ogre::RenderWindow* rw);
+            void windowClosed      (Ogre::RenderWindow* rw);
+
             static GraphicsEngine& getSingleton();
             static GraphicsEngine* getSingletonPtr() { return &getSingleton(); }
-
-            void windowMoved(Ogre::RenderWindow* rw);
-            void windowResized(Ogre::RenderWindow* rw);
-            void windowFocusChanged(Ogre::RenderWindow* rw);
 
         private:
@@ -92,5 +95,5 @@
             Ogre::RenderWindow* renderWindow_;//!< the current render window
             //bool               bOverwritePath_; //!< overwrites path
-            std::string         configPath_;  //!< path to config file
+            //std::string         configPath_;  //!< path to config file
             std::string         dataPath_;    //!< path to data file
             std::string         ogreLogfile_; //!< log file name for Ogre log messages
Index: /code/branches/merge/src/orxonox/Main.cc
===================================================================
--- /code/branches/merge/src/orxonox/Main.cc	(revision 1262)
+++ /code/branches/merge/src/orxonox/Main.cc	(revision 1263)
@@ -78,11 +78,13 @@
     Orxonox* orx = Orxonox::getSingleton();
 
+    bool res = false;
 #if ORXONOX_PLATFORM == ORXONOX_PLATFORM_APPLE
-    orx->init(argc, argv, macBundlePath());
+    res = orx->init(argc, argv, macBundlePath());
 #else
-    orx->init(argc, argv, "");
+    res = orx->init(argc, argv, "");
 #endif
 
-    orx->start();
+    if (res)
+      orx->start();
     orx->destroySingleton();
   /*}
Index: /code/branches/merge/src/orxonox/Orxonox.cc
===================================================================
--- /code/branches/merge/src/orxonox/Orxonox.cc	(revision 1262)
+++ /code/branches/merge/src/orxonox/Orxonox.cc	(revision 1263)
@@ -37,10 +37,7 @@
 
 //****** STD *******
-//#include <iostream>
-//#include <exception>
 #include <deque>
 
 //****** OGRE ******
-//#include <OgreException.h>
 #include <OgreFrameListener.h>
 #include <OgreOverlay.h>
@@ -65,4 +62,5 @@
 #include "core/InputBuffer.h"
 #include "core/InputManager.h"
+#include "core/TclBind.h"
 
 // audio
@@ -158,24 +156,23 @@
 
   /**
-   * create a new instance of Orxonox
-   */
-  Orxonox::Orxonox()
-  {
-    this->mode_ = STANDALONE;
-    this->serverIp_ = "";
-    this->ogre_ = &GraphicsEngine::getSingleton();
-    this->timer_ = 0;
-    this->dataPath_ = "";
-    this->auMan_ = 0;
-    this->orxonoxHUD_ = 0;
-    this->inputHandler_ = 0;
+   * Create a new instance of Orxonox. Avoid doing any actual work here.
+   */
+  Orxonox::Orxonox() :
+    ogre_(&GraphicsEngine::getSingleton()),
+    //auMan_(0),
+    timer_(0),
     // turn on frame smoothing by setting a value different from 0
-    this->frameSmoothingTime_ = 0.0f;
-    this->bAbort_ = false;
-    this->timefactor_ = 1.0f;
-  }
-
-  /**
-   * destruct Orxonox
+    frameSmoothingTime_(0.0f),
+    orxonoxConsole_(0),
+    orxonoxHUD_(0),
+    bAbort_(false),
+    timefactor_(1.0f),
+    mode_(STANDALONE),
+    serverIp_("")
+  {
+  }
+
+  /**
+   * Destruct Orxonox.
    */
   Orxonox::~Orxonox()
@@ -186,6 +183,6 @@
     Loader::close();
     InputManager::destroy();
-    if (this->auMan_)
-      delete this->auMan_;
+    //if (this->auMan_)
+    //  delete this->auMan_;
     if (this->timer_)
       delete this->timer_;
@@ -199,14 +196,4 @@
 
   /**
-    @brief Immediately deletes the orxonox object.
-    Never use if you can help it while rendering!
-  */
-  void Orxonox::abortImmediateForce()
-  {
-    COUT(1) << "*** Orxonox Error: Orxonox object was unexpectedly destroyed." << std::endl;
-    delete this;
-  }
-
-  /**
     Asks the mainloop nicely to abort.
   */
@@ -218,5 +205,5 @@
 
   /**
-   * @return singleton object
+   * @return singleton reference
    */
   Orxonox* Orxonox::getSingleton()
@@ -243,5 +230,5 @@
    * @param path path to config (in home dir or something)
    */
-  void Orxonox::init(int argc, char **argv, std::string path)
+  bool Orxonox::init(int argc, char **argv, std::string path)
   {
     //TODO: find config file (assuming executable directory)
@@ -249,84 +236,110 @@
     //TODO: give config file to Ogre
     std::string mode;
+    std::string dataPath;
 
     ArgReader ar(argc, argv);
     ar.checkArgument("mode", mode, false);
-    ar.checkArgument("data", this->dataPath_, false);
+    ar.checkArgument("data", dataPath, false);
     ar.checkArgument("ip", serverIp_, false);
-    if(ar.errorHandling()) abortImmediateForce();
-    if(mode == std::string("client"))
+    if(ar.errorHandling())
+      return false;
+
+    COUT(3) << "*** Orxonox: Mode is " << mode << "." << std::endl;
+    if (mode == "client")
+      mode_ = CLIENT;
+    else if (mode == "server")
+      mode_ = SERVER;
+    else
+      mode_ = STANDALONE;
+
+    //if (mode_ == DEDICATED)
+      // TODO: decide what to do here
+    //else
+
+    // for playable server, client and standalone, the startup
+    // procedure until the GUI is identical
+
+    TclBind::getInstance().setDataPath(dataPath);
+    ConfigFileManager::getSingleton()->setFile(CFT_Settings, "orxonox.ini");
+    Factory::createClassHierarchy();
+
+    if (!ogre_->setup(path))       // creates ogre root and other essentials
+      return false;
+
+    return true;
+  }
+
+  /**
+   * start modules
+   */
+  bool Orxonox::start()
+  {
+    //if (mode == DEDICATED)
+    // do something else
+    //else
+
+    if (!ogre_->loadRenderer())    // creates the render window
+      return false;
+
+    // Calls the InputManager which sets up the input devices.
+    // The render window width and height are used to set up the mouse movement.
+    if (!InputManager::initialise(ogre_->getWindowHandle(),
+          ogre_->getWindowWidth(), ogre_->getWindowHeight()))
+      return false;
+
+    // TODO: Spread this so that this call only initialises things needed for the GUI
+    if (!ogre_->initialiseResources())
+      return false;
+
+    // TOOD: load the GUI here
+    // set InputManager to GUI mode
+    InputManager::setInputState(InputManager::IS_GUI);
+    // TODO: run GUI here
+
+    // The following lines depend very much on the GUI output, so they're probably misplaced here..
+
+    InputManager::setInputState(InputManager::IS_NONE);
+
+    if (!loadPlayground())
+      return false;
+
+    switch (mode_)
     {
-      mode_ = CLIENT;
-      clientInit(path);
-    }
-    else if(mode== std::string("server")){
-      mode_ = SERVER;
-      serverInit(path);
-    }
-    else{
-      mode_ = STANDALONE;
-      standaloneInit(path);
-    }
-  }
-
-  void Orxonox::serverInit(std::string path)
-  {
-    COUT(2) << "initialising server" << std::endl;
-
-    ogre_->setConfigPath(path);
-    ogre_->setup();
-    //root_ = ogre_->getRoot();
-    if(!ogre_->load(this->dataPath_)) abortImmediateForce(/* unable to load */);
-
-    server_g = new network::Server();
-  }
-
-  void Orxonox::clientInit(std::string path)
-  {
-    COUT(2) << "initialising client" << std::endl;\
-
-    ogre_->setConfigPath(path);
-    ogre_->setup();
-    if(serverIp_.compare("")==0)
-      client_g = new network::Client();
-    else
-      client_g = new network::Client(serverIp_, NETWORK_PORT);
-    if(!ogre_->load(this->dataPath_)) abortImmediateForce(/* unable to load */);
-  }
-
-  void Orxonox::standaloneInit(std::string path)
-  {
-    COUT(2) << "initialising standalone mode" << std::endl;
-
-    ogre_->setConfigPath(path);
-    ogre_->setup();
-    if(!ogre_->load(this->dataPath_)) abortImmediateForce(/* unable to load */);
-  }
-
-  /**
-   * start modules
-   */
-  void Orxonox::start()
-  {
-    switch(mode_){
+    case SERVER:
+      if (!serverLoad())
+        return false;
+      break;
     case CLIENT:
-      clientStart();
-      break;
-    case SERVER:
-      serverStart();
+      if (!clientLoad())
+        return false;
       break;
     default:
-      standaloneStart();
+      if (!standaloneLoad())
+        return false;
     }
-  }
-
-  void Orxonox::clientStart(){
-    ogre_->initialise();
-    ConfigFileManager::getSingleton()->setFile(CFT_Settings, "orxonox.ini");
-    Factory::createClassHierarchy();
-
-
-    auMan_ = new audio::AudioManager();
-
+
+    InputManager::setInputState(InputManager::IS_NORMAL);
+
+    return startRenderLoop();
+  }
+
+  /**
+   * Loads everything in the scene except for the actual objects.
+   * This includes HUD, Console..
+   */
+  bool Orxonox::loadPlayground()
+  {
+    ogre_->createNewScene();
+
+	  // Init audio
+    //auMan_ = new audio::AudioManager();
+    //auMan_->ambientAdd("a1");
+    //auMan_->ambientAdd("a2");
+    //auMan_->ambientAdd("a3");
+    //auMan->ambientAdd("ambient1");
+    //auMan_->ambientStart();
+
+    // Load the HUD
+    COUT(3) << "*** Orxonox: Loading HUD..." << std::endl;
     Ogre::Overlay* hudOverlay = Ogre::OverlayManager::getSingleton().getByName("Orxonox/HUD1.2");
     orxonoxHUD_ = new HUD();
@@ -335,91 +348,5 @@
     hudOverlay->show();
 
-    client_g->establishConnection();
-    client_g->tick(0);
-
-
-    //setupInputSystem();
-
-    startRenderLoop();
-  }
-
-  void Orxonox::serverStart(){
-    //TODO: start modules
-    ogre_->initialise();
-    //TODO: run engine
-    ConfigFileManager::getSingleton()->setFile(CFT_Settings, "orxonox.ini");
-    Factory::createClassHierarchy();
-    createScene();
-    setupInputSystem();
-
-    server_g->open();
-
-    startRenderLoop();
-  }
-
-  void Orxonox::standaloneStart(){
-    //TODO: start modules
-    ogre_->initialise();
-    //TODO: run engine
-    ConfigFileManager::getSingleton()->setFile(CFT_Settings, "orxonox.ini");
-    Factory::createClassHierarchy();
-    createScene();
-    setupInputSystem();
-
-    startRenderLoop();
-  }
-
-  void Orxonox::createScene(void)
-  {
-	  // Init audio
-    auMan_ = new audio::AudioManager();
-
-    // load this file from config
-    Level* startlevel = new Level("levels/sample.oxw");
-    Loader::open(startlevel);
-
-    Ogre::Overlay* hudOverlay = Ogre::OverlayManager::getSingleton().getByName("Orxonox/HUD1.2");
-    orxonoxHUD_ = new HUD();
-    orxonoxHUD_->setEnergyValue(20);
-    orxonoxHUD_->setEnergyDistr(20,20,60);
-    hudOverlay->show();
-
-	/*
-    auMan_->ambientAdd("a1");
-    auMan_->ambientAdd("a2");
-    auMan_->ambientAdd("a3");
-    //auMan->ambientAdd("ambient1");
-    auMan_->ambientStart();
-  */
-  }
-
-  /**
-    @brief Calls the InputHandler which sets up the input devices.
-    The render window width and height are used to set up the mouse movement.
-  */
-  void Orxonox::setupInputSystem()
-  {
-    if (!InputManager::initialise(ogre_->getWindowHandle(),
-          ogre_->getWindowWidth(), ogre_->getWindowHeight()))
-      abortImmediateForce();
-    InputManager::setInputState(InputManager::IS_NORMAL);
-  }
-
-  /**
-    Main loop of the orxonox game.
-    This is a new solution, using the ogre engine instead of being used by it.
-    An alternative solution would be to simply use the timer of the Root object,
-    but that implies using Ogre in any case. There would be no way to test
-    our code without the help of the root object.
-    There's even a chance that we can dispose of the root object entirely
-    in server mode.
-    About the loop: The design is almost exactly like the one in ogre, so that
-    if any part of ogre registers a framelisteners, it will still behave
-    correctly. Furthermore the time smoothing feature from ogre has been
-    implemented too. If turned on (see orxonox constructor), it will calculate
-    the dt_n by means of the recent most dt_n-1, dt_n-2, etc.
-  */
-  void Orxonox::startRenderLoop()
-  {
+    COUT(3) << "*** Orxonox: Loading Console..." << std::endl;
     InputBuffer* ib = dynamic_cast<InputBuffer*>(InputManager::getKeyHandler("buffer"));
     /*
@@ -432,5 +359,4 @@
     ib->registerListener(console, &Testconsole::exit, (char)0x1B, true);
     */
-
     orxonoxConsole_ = new InGameConsole(ib);
     ib->registerListener(orxonoxConsole_, &InGameConsole::listen, true);
@@ -441,9 +367,82 @@
     ib->registerListener(orxonoxConsole_, &InGameConsole::exit, (char)0x1B, true);
 
+    return true;
+  }
+
+  /**
+   * Level loading method for server mode.
+   */
+  bool Orxonox::serverLoad()
+  {
+    COUT(2) << "Loading level in server mode" << std::endl;
+
+    server_g = new network::Server();
+
+    if (!loadScene())
+      return false;
+
+    server_g->open();
+
+    return true;
+  }
+
+  /**
+   * Level loading method for client mode.
+   */
+  bool Orxonox::clientLoad()
+  {
+    COUT(2) << "Loading level in client mode" << std::endl;\
+
+    if (serverIp_.compare("") == 0)
+      client_g = new network::Client();
+    else
+      client_g = new network::Client(serverIp_, NETWORK_PORT);
+
+    client_g->establishConnection();
+    client_g->tick(0);
+
+    return true;
+  }
+
+  /**
+   * Level loading method for standalone mode.
+   */
+  bool Orxonox::standaloneLoad()
+  {
+    COUT(2) << "Loading level in standalone mode" << std::endl;
+
+    if (!loadScene())
+      return false;
+
+    return true;
+  }
+
+  /**
+   * Helper method to load a level.
+   */
+  bool Orxonox::loadScene()
+  {
+    Level* startlevel = new Level("levels/sample.oxw");
+    Loader::open(startlevel);
+
+    return true;
+  }
+
+
+  /**
+    Main loop of the orxonox game.
+    About the loop: The design is almost exactly like the one in ogre, so that
+    if any part of ogre registers a framelisteners, it will still behave
+    correctly. Furthermore the time smoothing feature from ogre has been
+    implemented too. If turned on (see orxonox constructor), it will calculate
+    the dt_n by means of the recent most dt_n-1, dt_n-2, etc.
+  */
+  bool Orxonox::startRenderLoop()
+  {
     // first check whether ogre root object has been created
     if (Ogre::Root::getSingletonPtr() == 0)
     {
       COUT(2) << "*** Orxonox Error: Could not start rendering. No Ogre root object found" << std::endl;
-      return;
+      return false;
     }
     Ogre::Root& ogreRoot = Ogre::Root::getSingleton();
@@ -465,4 +464,5 @@
     timer_->reset();
 
+    COUT(3) << "*** Orxonox: Starting the main loop." << std::endl;
 	  while (!bAbort_)
 	  {
@@ -510,4 +510,6 @@
       ogreRoot._fireFrameEnded(evt);
 	  }
+
+    return true;
   }
 
@@ -550,6 +552,10 @@
   }
 
+  /**
+   * Static function that shows the console in game mode.
+   */
   void Orxonox::activateConsole()
   {
+    // currently, the console shows itself when feeded with input.
     InputManager::setInputState(InputManager::IS_CONSOLE);
   }
Index: /code/branches/merge/src/orxonox/Orxonox.h
===================================================================
--- /code/branches/merge/src/orxonox/Orxonox.h	(revision 1262)
+++ /code/branches/merge/src/orxonox/Orxonox.h	(revision 1263)
@@ -57,9 +57,9 @@
   {
     public:
-      void init(int argc, char **argv, std::string path);
-      void start();
-      void abortImmediateForce();
+      bool init(int argc, char **argv, std::string path);
+      bool start();
+
       void abortRequest();
-      inline audio::AudioManager* getAudioManagerPointer() { return auMan_; };
+      //inline audio::AudioManager* getAudioManagerPointer() { return auMan_; };
 
       static Orxonox* getSingleton();
@@ -79,24 +79,19 @@
       ~Orxonox();
 
-      // init functions
-      void serverInit(std::string path);
-      void clientInit(std::string path);
-      void standaloneInit(std::string path);
+      bool loadPlayground();
 
-      // run functions
-      void serverStart();
-      void clientStart();
-      void standaloneStart();
+      bool serverLoad();
+      bool clientLoad();
+      bool standaloneLoad();
 
-      void createScene();
-      void setupInputSystem();
-      void startRenderLoop();
+      bool loadScene();
+
+      bool startRenderLoop();
+
       float calculateEventTime(unsigned long, std::deque<unsigned long>&);
 
     private:
       GraphicsEngine*       ogre_;          //!< our dearest graphics engine <3
-      std::string           dataPath_;      //!< path to data
-      audio::AudioManager*  auMan_;         //!< audio manager
-      InputManager*         inputHandler_;  //!< Handles input with key bindings
+      //audio::AudioManager*  auMan_;         //!< audio manager
       Ogre::Timer*          timer_;         //!< Main loop timer
       // TODO: make this a config-value by creating a config class for orxonox
Index: /code/branches/merge/src/orxonox/OrxonoxPlatform.h
===================================================================
--- /code/branches/merge/src/orxonox/OrxonoxPlatform.h	(revision 1262)
+++ /code/branches/merge/src/orxonox/OrxonoxPlatform.h	(revision 1263)
@@ -21,5 +21,5 @@
  *
  *   Author:
- *      An unknown man from the Ogre development crew
+ *      ...
  *   Co-authors:
  *      Reto Grieder
Index: /code/branches/merge/src/orxonox/console/InGameConsole.cc
===================================================================
--- /code/branches/merge/src/orxonox/console/InGameConsole.cc	(revision 1262)
+++ /code/branches/merge/src/orxonox/console/InGameConsole.cc	(revision 1263)
@@ -54,9 +54,18 @@
     const float BLINK = 0.25;
 
-    InGameConsole::InGameConsole(InputBuffer* ib){
+    InGameConsole::InGameConsole(InputBuffer* ib) :
+        windowW(0), windowH(0),
+        scroll(0), scrollTimer(0.0f),
+        cursor(0.0f),
+        active(false),
+        ib_(ib),
+        om(0),
+        consoleOverlay(0),
+        consoleOverlayContainer(0),
+        consoleOverlayNoise(0),
+        consoleOverlayBorder(0),
+        consoleOverlayTextAreas(0)
+    {
         //RegisterObject(InGameConsole);
-        ib_ = ib;
-        active = false;
-        cursor = 0.0;
         init();
     }
Index: /code/branches/merge/src/orxonox/objects/Explosion.cc
===================================================================
--- /code/branches/merge/src/orxonox/objects/Explosion.cc	(revision 1262)
+++ /code/branches/merge/src/orxonox/objects/Explosion.cc	(revision 1263)
@@ -45,10 +45,9 @@
     CreateFactory(Explosion);
 
-    Explosion::Explosion(WorldEntity* owner)
+    Explosion::Explosion(WorldEntity* owner) :
+      particle_(0),
+      lifetime_(0.4)
     {
         RegisterObject(Explosion);
-
-        this->particle_ = 0;
-        this->lifetime_ = 0.4;
 
         if (owner)
Index: /code/branches/merge/src/orxonox/objects/Model.cc
===================================================================
--- /code/branches/merge/src/orxonox/objects/Model.cc	(revision 1262)
+++ /code/branches/merge/src/orxonox/objects/Model.cc	(revision 1263)
@@ -49,15 +49,4 @@
     }
 
-    void Model::loadParams(TiXmlElement* xmlElem)
-    {
-        WorldEntity::loadParams(xmlElem);
-
-        if (xmlElem->Attribute("mesh"))
-        {
-            meshSrc_ = xmlElem->Attribute("mesh");
-        }
-        create();
-    }
-
     /**
         @brief XML loading and saving.
Index: /code/branches/merge/src/orxonox/objects/Model.h
===================================================================
--- /code/branches/merge/src/orxonox/objects/Model.h	(revision 1262)
+++ /code/branches/merge/src/orxonox/objects/Model.h	(revision 1263)
@@ -43,5 +43,4 @@
             Model();
             virtual ~Model();
-            virtual void loadParams(TiXmlElement* xmlElem);
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
             void setMesh(const std::string& meshname);
Index: /code/branches/merge/src/orxonox/objects/NPC.cc
===================================================================
--- /code/branches/merge/src/orxonox/objects/NPC.cc	(revision 1262)
+++ /code/branches/merge/src/orxonox/objects/NPC.cc	(revision 1263)
@@ -36,8 +36,8 @@
   CreateFactory(NPC);
 
-  NPC::NPC()
+  NPC::NPC() :
+    movable_(true)
   {
     RegisterObject(NPC);
-    movable_ = true;
   }
 
Index: /code/branches/merge/src/orxonox/objects/Projectile.cc
===================================================================
--- /code/branches/merge/src/orxonox/objects/Projectile.cc	(revision 1262)
+++ /code/branches/merge/src/orxonox/objects/Projectile.cc	(revision 1263)
@@ -42,11 +42,10 @@
     CreateFactory(Projectile);
 
-    Projectile::Projectile(SpaceShip* owner)
+    Projectile::Projectile(SpaceShip* owner) :
+      owner_(owner)
     {
         RegisterObject(Projectile);
 
         this->setConfigValues();
-
-        this->owner_ = owner;
 
         this->billboard_.setBillboardSet("Examples/Flare", ColourValue(1.0, 1.0, 0.5), 1);
Index: /code/branches/merge/src/orxonox/objects/SpaceShip.cc
===================================================================
--- /code/branches/merge/src/orxonox/objects/SpaceShip.cc	(revision 1262)
+++ /code/branches/merge/src/orxonox/objects/SpaceShip.cc	(revision 1263)
@@ -64,10 +64,5 @@
     SpaceShip::SpaceShip()
     {
-        RegisterObject(SpaceShip);
-        this->registerAllVariables();
-
         SpaceShip::instance_s = this;
-
-        this->setConfigValues();
 
         this->setMouseEventCallback_ = false;
@@ -139,4 +134,7 @@
 //         this->create();
 
+        RegisterObject(SpaceShip);
+        this->registerAllVariables();
+        this->setConfigValues();
 
         COUT(3) << "Info: SpaceShip was loaded" << std::endl;
@@ -166,4 +164,10 @@
     void SpaceShip::init()
     {
+        if (!setMouseEventCallback_)
+        {
+          InputManager::addMouseHandler(this, "SpaceShip");
+          setMouseEventCallback_ = true;
+        }
+
         // START CREATING THRUSTER
         this->tt_ = new ParticleInterface(GraphicsEngine::getSingleton().getSceneManager(),"twinthruster" + this->getName(),"Orxonox/engineglow");
@@ -428,10 +432,4 @@
     void SpaceShip::tick(float dt)
     {
-        if (!setMouseEventCallback_)
-        {
-          InputManager::addMouseHandler(this, "SpaceShip");
-          setMouseEventCallback_ = true;
-        }
-
         if (this->redNode_ && this->greenNode_)
         {
Index: /code/branches/merge/src/orxonox/objects/WorldEntity.cc
===================================================================
--- /code/branches/merge/src/orxonox/objects/WorldEntity.cc	(revision 1262)
+++ /code/branches/merge/src/orxonox/objects/WorldEntity.cc	(revision 1263)
@@ -45,16 +45,14 @@
     unsigned int WorldEntity::worldEntityCounter_s = 0;
 
-    WorldEntity::WorldEntity()
+    WorldEntity::WorldEntity() :
+      velocity_    (0, 0, 0),
+      acceleration_(0, 0, 0),
+      rotationAxis_(0, 1, 0),
+      rotationRate_(0),
+      momentum_    (0),
+      node_        (0),
+      bStatic_     (true)
     {
         RegisterObject(WorldEntity);
-
-        //create();
-
-        this->bStatic_ = true;
-        this->velocity_ = Vector3(0, 0, 0);
-        this->acceleration_ = Vector3(0, 0, 0);
-        this->rotationAxis_ = Vector3(0, 1, 0);
-        this->rotationRate_ = 0;
-        this->momentum_ = 0;
 
         if (GraphicsEngine::getSingleton().getSceneManager())
@@ -66,8 +64,4 @@
 
           registerAllVariables();
-        }
-        else
-        {
-          this->node_ = 0;
         }
     }
@@ -94,71 +88,4 @@
         BaseObject::loadParams(xmlElem);
         create();
-/*
-        if (xmlElem->Attribute("position"))
-        {
-            std::vector<std::string> pos = tokenize(xmlElem->Attribute("position"),",");
-            float x, y, z;
-            String2Number<float>(x, pos[0]);
-            String2Number<float>(y, pos[1]);
-            String2Number<float>(z, pos[2]);
-            this->setPosition(x, y, z);
-        }
-
-        if (xmlElem->Attribute("direction"))
-        {
-            std::vector<std::string> pos = tokenize(xmlElem->Attribute("direction"),",");
-            float x, y, z;
-            String2Number<float>(x, pos[0]);
-            String2Number<float>(y, pos[1]);
-            String2Number<float>(z, pos[2]);
-            this->setDirection(x, y, z);
-        }
-
-        if (xmlElem->Attribute("yaw") || xmlElem->Attribute("pitch") || xmlElem->Attribute("roll"))
-        {
-            float yaw = 0.0, pitch = 0.0, roll = 0.0;
-            if (xmlElem->Attribute("yaw"))
-                String2Number<float>(yaw,xmlElem->Attribute("yaw"));
-
-            if (xmlElem->Attribute("pitch"))
-                String2Number<float>(pitch,xmlElem->Attribute("pitch"));
-
-            if (xmlElem->Attribute("roll"))
-                String2Number<float>(roll,xmlElem->Attribute("roll"));
-
-            this->yaw(Degree(yaw));
-            this->pitch(Degree(pitch));
-            this->roll(Degree(roll));
-        }
-
-        if (xmlElem->Attribute("scale"))
-        {
-            std::string scaleStr = xmlElem->Attribute("scale");
-            float scale;
-            String2Number<float>(scale, scaleStr);
-            this->setScale(scale);
-        }
-
-        if (xmlElem->Attribute("rotationAxis"))
-        {
-            std::vector<std::string> pos = tokenize(xmlElem->Attribute("rotationAxis"),",");
-            float x, y, z;
-            String2Number<float>(x, pos[0]);
-            String2Number<float>(y, pos[1]);
-            String2Number<float>(z, pos[2]);
-            this->setRotationAxis(x, y, z);
-        }
-
-        if (xmlElem->Attribute("rotationRate"))
-        {
-            float rotationRate;
-            String2Number<float>(rotationRate, xmlElem->Attribute("rotationRate"));
-            this->setRotationRate(Degree(rotationRate));
-            if (rotationRate != 0)
-                this->setStatic(false);
-        }
-
-        create();
-*/
     }
 
Index: /code/branches/merge/src/orxonox/tools/Timer.cc
===================================================================
--- /code/branches/merge/src/orxonox/tools/Timer.cc	(revision 1262)
+++ /code/branches/merge/src/orxonox/tools/Timer.cc	(revision 1263)
@@ -68,6 +68,4 @@
     TimerBase::TimerBase()
     {
-        RegisterRootObject(TimerBase);
-
         this->executor_ = 0;
         this->interval_ = 0;
@@ -76,4 +74,6 @@
 
         this->time_ = 0;
+
+        RegisterRootObject(TimerBase);
     }
 
@@ -83,5 +83,6 @@
     TimerBase::~TimerBase()
     {
-        delete this->executor_;
+      if (this->executor_)
+          delete this->executor_;
     }
 
