Index: code/trunk/src/orxonox/gamestates/GSClient.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSClient.cc	(revision 10299)
+++ code/trunk/src/orxonox/gamestates/GSClient.cc	(revision 10624)
@@ -30,5 +30,5 @@
 
 #include "util/Exception.h"
-#include "core/config/CommandLineParser.h"
+#include "core/commandline/CommandLineIncludes.h"
 #include "core/Game.h"
 #include "core/GameMode.h"
Index: code/trunk/src/orxonox/gamestates/GSLevel.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSLevel.cc	(revision 10299)
+++ code/trunk/src/orxonox/gamestates/GSLevel.cc	(revision 10624)
@@ -44,7 +44,8 @@
 #include "core/Loader.h"
 #include "core/XMLFile.h"
-#include "core/command/ConsoleCommand.h"
+#include "core/command/ConsoleCommandIncludes.h"
 
 #include "LevelManager.h"
+#include "Level.h"
 #include "PlayerManager.h"
 #include "GSRoot.h"
@@ -95,4 +96,6 @@
         }
 
+        this->prepareObjectTracking();
+
         if (GameMode::isMaster())
         {
@@ -128,4 +131,8 @@
         if (GameMode::isMaster())
             this->unloadLevel();
+        else
+            this->unloadLevelAsClient();
+
+        this->performObjectTracking();
 
         if (GameMode::showsGraphics())
@@ -161,23 +168,12 @@
     }
 
-    void GSLevel::loadLevel()
+    void GSLevel::prepareObjectTracking()
     {
         for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it)
             this->staticObjects_.insert(*it);
-
-        // call the loader
-        startFile_ = new XMLFile(LevelManager::getInstance().getDefaultLevel());
-        bool loaded = Loader::open(startFile_);
-
-        Core::getInstance().updateLastLevelTimestamp();
-        if(!loaded)
-            GSRoot::delayedStartMainMenu();
-    }
-
-    void GSLevel::unloadLevel()
-    {
-        Loader::unload(startFile_);
-        delete startFile_;
-
+    }
+
+    void GSLevel::performObjectTracking()
+    {
         orxout(internal_info) << "Remaining objects:" << endl;
         unsigned int i = 0;
@@ -187,5 +183,5 @@
             if (find == this->staticObjects_.end())
             {
-                orxout(internal_info) << ++i << ": " << it->getIdentifier()->getName() << " (" << *it << "), references: " << it->getReferenceCount() << endl;
+                orxout(internal_warning) << ++i << ": " << it->getIdentifier()->getName() << " (" << *it << "), references: " << it->getReferenceCount() << endl;
             }
         }
@@ -194,4 +190,43 @@
         else
             orxout(internal_warning) << i << " objects remaining. Try harder!" << endl;
+    }
+
+    void GSLevel::loadLevel()
+    {
+        // call the loader
+        startFile_ = new XMLFile(LevelManager::getInstance().getDefaultLevel());
+        bool loaded = Loader::getInstance().load(startFile_);
+
+        Core::getInstance().getConfig()->updateLastLevelTimestamp();
+        if(!loaded)
+            GSRoot::delayedStartMainMenu();
+    }
+
+    void GSLevel::unloadLevel()
+    {
+        Loader::getInstance().unload(startFile_);
+        delete startFile_;
+    }
+
+    /**
+     * Unloads a level when the game instance is (or was) a client in a multiplayer session.
+     * In this case, cleanup after unloading a level is done differently because certain things (e.g. the xml file) are unknown.
+     */
+    void GSLevel::unloadLevelAsClient()
+    {
+        for (ObjectList<Level>::iterator it = ObjectList<Level>::begin(); it != ObjectList<Level>::end(); )
+        {
+            StrongPtr<Level> level = *(it++); // StrongPtr prevents that the Level gets destroyed while we loop over it
+            for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(level); it != ObjectList<BaseObject>::end(level); )
+                (it++)->destroy();
+        }
+
+        for (ObjectList<Synchronisable>::iterator it = ObjectList<Synchronisable>::begin(); it != ObjectList<Synchronisable>::end(); )
+        {
+            if (it->getSyncMode() != 0x0)
+                (it++)->destroy();
+            else
+                ++it;
+        }
     }
 
@@ -252,5 +287,5 @@
     ///////////////////////////////////////////////////////////////////////////
 
-    RegisterAbstractClass(GSLevelMemento).inheritsFrom(Class(OrxonoxInterface));
+    RegisterAbstractClass(GSLevelMemento).inheritsFrom<OrxonoxInterface>();
 
     GSLevelMemento::GSLevelMemento()
Index: code/trunk/src/orxonox/gamestates/GSLevel.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSLevel.h	(revision 10299)
+++ code/trunk/src/orxonox/gamestates/GSLevel.h	(revision 10624)
@@ -53,7 +53,11 @@
         void reloadLevel();
 
-    protected:
+    private:
         void loadLevel();
         void unloadLevel();
+        void unloadLevelAsClient();
+
+        void prepareObjectTracking();
+        void performObjectTracking();
 
         InputState*              gameInputState_;          //!< input state for normal ingame playing
Index: code/trunk/src/orxonox/gamestates/GSMainMenu.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSMainMenu.cc	(revision 10299)
+++ code/trunk/src/orxonox/gamestates/GSMainMenu.cc	(revision 10624)
@@ -36,5 +36,5 @@
 #include "core/GraphicsManager.h"
 #include "core/GUIManager.h"
-#include "core/command/ConsoleCommand.h"
+#include "core/command/ConsoleCommandIncludes.h"
 #include "core/input/KeyBinderManager.h"
 #include "network/Client.h"
@@ -63,4 +63,6 @@
     SetConsoleCommand(__CC_setMainMenuSoundPath_name, &GSMainMenu::setMainMenuSoundPath).hide();
 
+    RegisterAbstractClass(GSMainMenu).inheritsFrom<Configurable>();
+
     GSMainMenu::GSMainMenu(const GameStateInfo& info)
         : GameState(info)
Index: code/trunk/src/orxonox/gamestates/GSRoot.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSRoot.cc	(revision 10299)
+++ code/trunk/src/orxonox/gamestates/GSRoot.cc	(revision 10624)
@@ -33,6 +33,6 @@
 #include "core/Game.h"
 #include "core/GameMode.h"
-#include "core/command/ConsoleCommand.h"
-#include "network/NetworkFunction.h"
+#include "core/command/ConsoleCommandIncludes.h"
+#include "network/NetworkFunctionIncludes.h"
 #include "tools/Timer.h"
 #include "tools/interfaces/Tickable.h"
@@ -68,5 +68,4 @@
     GSRoot::~GSRoot()
     {
-        NetworkFunctionBase::destroyAllNetworkFunctions();
     }
 
Index: code/trunk/src/orxonox/gamestates/GSServer.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSServer.cc	(revision 10299)
+++ code/trunk/src/orxonox/gamestates/GSServer.cc	(revision 10624)
@@ -30,5 +30,5 @@
 
 #include "util/Output.h"
-#include "core/config/CommandLineParser.h"
+#include "core/commandline/CommandLineIncludes.h"
 #include "core/Game.h"
 #include "core/GameMode.h"
