Index: /code/branches/resource/src/core/Loader.cc
===================================================================
--- /code/branches/resource/src/core/Loader.cc	(revision 3338)
+++ /code/branches/resource/src/core/Loader.cc	(revision 3339)
@@ -30,10 +30,8 @@
 
 #include <tinyxml/ticpp.h>
-#include <boost/filesystem.hpp>
 
 #include "util/Debug.h"
 #include "util/Exception.h"
 #include "BaseObject.h"
-#include "Core.h"
 #include "Iterator.h"
 #include "ObjectList.h"
@@ -210,23 +208,3 @@
         return Loader::load(file, mask);
     }
-
-    std::vector<std::string> Loader::getLevelList()
-    {
-        std::vector<std::string> levelList;
-
-        boost::filesystem::directory_iterator file(Core::getMediaPathString() + "levels");
-        boost::filesystem::directory_iterator end;
-
-        while (file != end)
-        {
-            if (!boost::filesystem::is_directory(*file) && file->string()[file->string().length()-1] != '~')
-            {
-                std::string filename = file->path().leaf();
-                if (filename.length() > 4)
-                    levelList.push_back(filename.substr(0,filename.length()-4));
-            }
-            ++file;
-        }
-        return levelList;
-    }
 }
Index: /code/branches/resource/src/core/Loader.h
===================================================================
--- /code/branches/resource/src/core/Loader.h	(revision 3338)
+++ /code/branches/resource/src/core/Loader.h	(revision 3339)
@@ -56,5 +56,4 @@
 
             static ClassTreeMask currentMask_s;
-            static std::vector<std::string> getLevelList();
 
         private:
Index: /code/branches/resource/src/orxonox/LevelManager.cc
===================================================================
--- /code/branches/resource/src/orxonox/LevelManager.cc	(revision 3338)
+++ /code/branches/resource/src/orxonox/LevelManager.cc	(revision 3339)
@@ -30,8 +30,10 @@
 
 #include <map>
+#include <boost/filesystem.hpp>
 
 #include "core/CommandLine.h"
 #include "core/ConfigValueIncludes.h"
 #include "core/CoreIncludes.h"
+#include "core/Loader.h"
 #include "PlayerManager.h"
 #include "objects/Level.h"
@@ -120,7 +122,34 @@
     }
 
-    const std::string& LevelManager::getDefaultLevel()
+    const std::string& LevelManager::getDefaultLevel() const
     {
         return defaultLevelName_;
     }
+
+    std::string LevelManager::getAvailableLevelListItem(unsigned int index) const
+    {
+        if (index >= availableLevels_.size())
+            return std::string();
+        else
+            return availableLevels_[index];
+    }
+
+    void LevelManager::compileAvailableLevelList()
+    {
+        availableLevels_.clear();
+
+        boost::filesystem::directory_iterator file(Core::getMediaPathString() + "levels");
+        boost::filesystem::directory_iterator end;
+
+        while (file != end)
+        {
+            if (!boost::filesystem::is_directory(*file) && file->string()[file->string().length()-1] != '~')
+            {
+                std::string filename = file->path().leaf();
+                if (filename.length() > 4)
+                    availableLevels_.push_back(filename.substr(0,filename.length()-4));
+            }
+            ++file;
+        }
+    }
 }
Index: /code/branches/resource/src/orxonox/LevelManager.h
===================================================================
--- /code/branches/resource/src/orxonox/LevelManager.h	(revision 3338)
+++ /code/branches/resource/src/orxonox/LevelManager.h	(revision 3339)
@@ -55,5 +55,7 @@
 
             void setDefaultLevel(const std::string& levelName); //tolua_export
-            const std::string& getDefaultLevel(); //tolua_export
+            const std::string& getDefaultLevel() const; //tolua_export
+            void compileAvailableLevelList(); //tolua_export
+            std::string getAvailableLevelListItem(unsigned int index) const; //tolua_export
 
             static LevelManager* getInstancePtr() { return singletonRef_s; }
@@ -66,4 +68,5 @@
 
             std::list<Level*> levels_s;
+            std::vector<std::string> availableLevels_;
 
             // config values
Index: /code/branches/resource/src/orxonox/gamestates/GSMainMenu.cc
===================================================================
--- /code/branches/resource/src/orxonox/gamestates/GSMainMenu.cc	(revision 3338)
+++ /code/branches/resource/src/orxonox/gamestates/GSMainMenu.cc	(revision 3339)
@@ -67,5 +67,5 @@
 
         // show main menu
-        GUIManager::getInstance().showGUI("mainmenu_3");
+        GUIManager::getInstance().showGUI("mainmenu_4");
         GUIManager::getInstance().setCamera(this->camera_);
         GraphicsManager::getInstance().setCamera(this->camera_);
Index: /code/branches/resource/src/orxonox/gui/GUIManager.cc
===================================================================
--- /code/branches/resource/src/orxonox/gui/GUIManager.cc	(revision 3338)
+++ /code/branches/resource/src/orxonox/gui/GUIManager.cc	(revision 3339)
@@ -61,5 +61,4 @@
 #include "ToluaBindCore.h"
 #include "ToluaBindOrxonox.h"
-#include "core/Loader.h"
 
 namespace orxonox
@@ -88,4 +87,5 @@
 
     static CEGUI::MouseButton convertButton(MouseButtonCode::ByEnum button);
+
     GUIManager* GUIManager::singletonRef_s = 0;
 
@@ -157,5 +157,5 @@
         Destructor of the GUIManager
 
-        Basically shuts down CEGUI and destroys the Lua engine and afterwards the interface to the Ogre engine.
+        Basically shuts down CEGUI (member smart pointers) but first unloads our Tolua modules.
     */
     GUIManager::~GUIManager()
@@ -174,7 +174,4 @@
         Calls main Lua script
     @todo
-        Replace loadGUI.lua with loadGUI_2.lua after merging this back to trunk.
-        However CEGUI is able to execute a startup script. We could maybe put this call in this startup code.
-
         This function calls the main Lua script for our GUI.
 
@@ -183,21 +180,9 @@
     void GUIManager::loadLuaCode()
     {
-        try
-        {
-            // set datapath for GUI data
-            lua_pushfstring(this->scriptModule_->getLuaState(), Core::getMediaPathString().c_str());
-            lua_setglobal(this->scriptModule_->getLuaState(), "datapath");
-            // call main Lua script
-            this->scriptModule_->executeScriptFile("loadGUI_3.lua", "GUI");
-        }
-        catch (CEGUI::Exception& ex)
-        {
-#if CEGUI_VERSION_MINOR < 6
-            throw GeneralException(ex.getMessage().c_str());
-#else
-            throw GeneralException(ex.getMessage().c_str(), ex.getLine(),
-                ex.getFileName().c_str(), ex.getName().c_str());
-#endif
-        }
+        // set datapath for GUI data
+        lua_pushfstring(this->scriptModule_->getLuaState(), Core::getMediaPathString().c_str());
+        lua_setglobal(this->scriptModule_->getLuaState(), "datapath");
+        // call main Lua script
+        this->scriptModule_->executeScriptFile("loadGUI_3.lua", "GUI");
     }
 
@@ -216,25 +201,4 @@
         assert(guiSystem_);
         guiSystem_->injectTimePulse(time.getDeltaTime());
-    }
-
-    /**
-
-    */
-    void GUIManager::getLevelList()
-    {
-        lua_State* L = this->scriptModule_->getLuaState();
-        lua_newtable(L);
-
-        std::vector<std::string> list = Loader::getLevelList();
-
-        int j = 1;
-        for (std::vector<std::string>::iterator i = list.begin(); i != list.end(); i++)
-        {
-            lua_pushnumber(L,j);
-            lua_pushstring(L,i->c_str());
-            lua_settable(L,-3);
-            j++;
-        }
-        lua_setglobal(L, "levellist");
     }
 
Index: /code/branches/resource/src/orxonox/gui/GUIManager.h
===================================================================
--- /code/branches/resource/src/orxonox/gui/GUIManager.h	(revision 3338)
+++ /code/branches/resource/src/orxonox/gui/GUIManager.h	(revision 3339)
@@ -47,5 +47,4 @@
 #include "core/input/InputHandler.h"
 
-// tolua_begin
 namespace orxonox
 {
@@ -61,10 +60,6 @@
         Those input events are then injected into CEGUI in Lua.
     */
-    class _OrxonoxExport GUIManager
-// tolua_end
-        : public InputHandler
-// tolua_begin
+    class _OrxonoxExport GUIManager : public InputHandler
     {
-// tolua_end
     public:
         GUIManager(Ogre::RenderWindow* renderWindow);
@@ -78,11 +73,9 @@
         void setCamera(Ogre::Camera* camera);
 
-        static GUIManager& getInstance()    { assert(singletonRef_s); return *singletonRef_s; } // tolua_export
+        static GUIManager& getInstance()    { assert(singletonRef_s); return *singletonRef_s; }
         static GUIManager* getInstancePtr() { return singletonRef_s; }
 
-        void getLevelList(); //tolua_export
-
     private:
-        GUIManager(const GUIManager& instance);                 //!< private constructor (this is a singleton class)
+        GUIManager(const GUIManager& instance); //!< private and undefined copy c'tor (this is a singleton class)
 
         void loadLuaCode();
@@ -108,6 +101,6 @@
         static GUIManager*       singletonRef_s;    //!< Singleton reference to GUIManager
 
-    }; // tolua_export
-} // tolua_export
+    };
+}
 
 #endif /* _GUIManager_H__ */
