Index: code/trunk/cmake/BuildConfigMSVC.cmake
===================================================================
--- code/trunk/cmake/BuildConfigMSVC.cmake	(revision 3279)
+++ code/trunk/cmake/BuildConfigMSVC.cmake	(revision 3280)
@@ -35,5 +35,5 @@
 
 # Currently VLD has a problem with MSVC9 although it actually is supported
-IF(MSVC8)
+IF(MSVC80)
   OPTION(VISUAL_LEAK_DETECTOR_ENABLE "Memory leak detector" off)
 ENDIF()
Index: code/trunk/src/core/ArgumentCompletionFunctions.cc
===================================================================
--- code/trunk/src/core/ArgumentCompletionFunctions.cc	(revision 3279)
+++ code/trunk/src/core/ArgumentCompletionFunctions.cc	(revision 3280)
@@ -34,5 +34,5 @@
 
 #include "util/Convert.h"
-#include "util/String.h"
+#include "util/StringUtils.h"
 #include "Identifier.h"
 #include "ConfigValueContainer.h"
@@ -143,5 +143,5 @@
 
             for (std::list<unsigned int>::const_iterator it = threadnumbers.begin(); it != threadnumbers.end(); ++it)
-                threads.push_back(ArgumentCompletionListElement(getConvertedValue<unsigned int, std::string>(*it)));
+                threads.push_back(ArgumentCompletionListElement(multi_cast<std::string>(*it)));
 
             return threads;
Index: code/trunk/src/core/BaseObject.cc
===================================================================
--- code/trunk/src/core/BaseObject.cc	(revision 3279)
+++ code/trunk/src/core/BaseObject.cc	(revision 3280)
@@ -36,5 +36,5 @@
 #include <tinyxml/tinyxml.h>
 
-#include "util/String.h"
+#include "util/StringUtils.h"
 #include "CoreIncludes.h"
 #include "Event.h"
Index: code/trunk/src/core/CMakeLists.txt
===================================================================
--- code/trunk/src/core/CMakeLists.txt	(revision 3279)
+++ code/trunk/src/core/CMakeLists.txt	(revision 3280)
@@ -68,5 +68,4 @@
   TOLUA_FILES
     CommandExecutor.h
-    Game.h
     LuaBind.h
   DEFINE_SYMBOL
Index: code/trunk/src/core/CommandEvaluation.cc
===================================================================
--- code/trunk/src/core/CommandEvaluation.cc	(revision 3279)
+++ code/trunk/src/core/CommandEvaluation.cc	(revision 3280)
@@ -30,5 +30,5 @@
 
 #include "util/Debug.h"
-#include "util/String.h"
+#include "util/StringUtils.h"
 #include "ConsoleCommand.h"
 #include "Identifier.h"
@@ -39,5 +39,5 @@
     {
         this->initialize("");
-        this->state_ = CS_Uninitialized;
+        this->state_ = CommandState::Uninitialized;
     }
 
@@ -64,5 +64,5 @@
 
         this->errorMessage_ = "";
-        this->state_ = CS_Empty;
+        this->state_ = CommandState::Empty;
     }
 
@@ -104,9 +104,9 @@
             switch (this->state_)
             {
-                case CS_Uninitialized:
-                    break;
-                case CS_Empty:
-                    break;
-                case CS_ShortcutOrIdentifier:
+                case CommandState::Uninitialized:
+                    break;
+                case CommandState::Empty:
+                    break;
+                case CommandState::ShortcutOrIdentifier:
                     if (this->function_)
                     {
@@ -119,5 +119,5 @@
                         return (this->command_ = this->functionclass_->getName() + " ");
                     break;
-                case CS_Function:
+                case CommandState::Function:
                     if (this->function_)
                     {
@@ -128,6 +128,6 @@
                     }
                     break;
-                case CS_ParamPreparation:
-                case CS_Params:
+                case CommandState::ParamPreparation:
+                case CommandState::Params:
                 {
                     if (this->argument_ == "" && this->possibleArgument_ == "")
@@ -149,7 +149,7 @@
                     break;
                 }
-                case CS_Finished:
-                    break;
-                case CS_Error:
+                case CommandState::Finished:
+                    break;
+                case CommandState::Error:
                     break;
             }
@@ -163,8 +163,8 @@
         switch (this->state_)
         {
-            case CS_Uninitialized:
-                break;
-            case CS_Empty:
-            case CS_ShortcutOrIdentifier:
+            case CommandState::Uninitialized:
+                break;
+            case CommandState::Empty:
+            case CommandState::ShortcutOrIdentifier:
                 if (this->listOfPossibleFunctions_.size() == 0)
                     return CommandEvaluation::dump(this->listOfPossibleIdentifiers_);
@@ -174,18 +174,18 @@
                     return (CommandEvaluation::dump(this->listOfPossibleFunctions_) + "\n" + CommandEvaluation::dump(this->listOfPossibleIdentifiers_));
                 break;
-            case CS_Function:
+            case CommandState::Function:
                 return CommandEvaluation::dump(this->listOfPossibleFunctions_);
                 break;
-            case CS_ParamPreparation:
-            case CS_Params:
+            case CommandState::ParamPreparation:
+            case CommandState::Params:
                 if (this->listOfPossibleArguments_.size() > 0)
                     return CommandEvaluation::dump(this->listOfPossibleArguments_);
                 else
                     return CommandEvaluation::dump(this->function_);
-            case CS_Finished:
+            case CommandState::Finished:
                 if (this->function_)
                     return CommandEvaluation::dump(this->function_);
                 break;
-            case CS_Error:
+            case CommandState::Error:
                 return this->errorMessage_;
                 break;
@@ -200,5 +200,5 @@
 
         for (unsigned int i = 0; i < MAX_FUNCTOR_ARGUMENTS; i++)
-            this->param_[i] = MT_null;
+            this->param_[i] = MT_Type::Null;
 
         if (!this->isValid())
@@ -230,5 +230,5 @@
             return this->param_[index];
 
-        return MT_null;
+        return MT_Type::Null;
     }
 
@@ -238,5 +238,5 @@
             return this->function_->hasReturnvalue();
 
-        return MT_null;
+        return MT_Type::Null;
     }
 
Index: code/trunk/src/core/CommandEvaluation.h
===================================================================
--- code/trunk/src/core/CommandEvaluation.h	(revision 3279)
+++ code/trunk/src/core/CommandEvaluation.h	(revision 3280)
@@ -41,15 +41,18 @@
 namespace orxonox
 {
-    enum CommandState
+    namespace CommandState
     {
-        CS_Uninitialized,
-        CS_Empty,
-        CS_ShortcutOrIdentifier,
-        CS_Function,
-        CS_ParamPreparation,
-        CS_Params,
-        CS_Finished,
-        CS_Error
-    };
+        enum Value
+        {
+            Uninitialized,
+            Empty,
+            ShortcutOrIdentifier,
+            Function,
+            ParamPreparation,
+            Params,
+            Finished,
+            Error
+        };
+    }
 
     class _CoreExport CommandEvaluation
@@ -112,5 +115,5 @@
 
             std::string errorMessage_;
-            CommandState state_;
+            CommandState::Value state_;
 
             bool bEvaluatedParams_;
Index: code/trunk/src/core/CommandExecutor.cc
===================================================================
--- code/trunk/src/core/CommandExecutor.cc	(revision 3279)
+++ code/trunk/src/core/CommandExecutor.cc	(revision 3280)
@@ -30,5 +30,5 @@
 
 #include "util/Debug.h"
-#include "util/String.h"
+#include "util/StringUtils.h"
 #include "ConsoleCommand.h"
 #include "Identifier.h"
@@ -141,5 +141,5 @@
     void CommandExecutor::parseIfNeeded(const std::string& command)
     {
-        if (CommandExecutor::getEvaluation().state_ == CS_Uninitialized)
+        if (CommandExecutor::getEvaluation().state_ == CommandState::Uninitialized)
         {
             CommandExecutor::parse(command);
@@ -169,10 +169,10 @@
         switch (CommandExecutor::getEvaluation().state_)
         {
-            case CS_Uninitialized:
+            case CommandState::Uninitialized:
             {
                 // Impossible
                 break;
             }
-            case CS_Empty:
+            case CommandState::Empty:
             {
                 if (CommandExecutor::argumentsGiven() == 0)
@@ -184,9 +184,9 @@
                 else
                 {
-                    CommandExecutor::getEvaluation().state_ = CS_ShortcutOrIdentifier;
+                    CommandExecutor::getEvaluation().state_ = CommandState::ShortcutOrIdentifier;
                     // Move on to next case
                 }
             }
-            case CS_ShortcutOrIdentifier:
+            case CommandState::ShortcutOrIdentifier:
             {
                 if (CommandExecutor::argumentsGiven() > 1)
@@ -199,5 +199,5 @@
                     {
                         // It's a shortcut
-                        CommandExecutor::getEvaluation().state_ = CS_ParamPreparation;
+                        CommandExecutor::getEvaluation().state_ = CommandState::ParamPreparation;
                         CommandExecutor::getEvaluation().functionclass_ = 0;
                         // Move on to next case
@@ -206,5 +206,5 @@
                     {
                         // It's a functionname
-                        CommandExecutor::getEvaluation().state_ = CS_Function;
+                        CommandExecutor::getEvaluation().state_ = CommandState::Function;
                         CommandExecutor::getEvaluation().function_ = 0;
                         // Move on to next case
@@ -213,5 +213,5 @@
                     {
                         // The first argument is bad
-                        CommandExecutor::getEvaluation().state_ = CS_Error;
+                        CommandExecutor::getEvaluation().state_ = CommandState::Error;
                         AddLanguageEntry("commandexecutorunknownfirstargument", "is not a shortcut nor a classname");
                         CommandExecutor::getEvaluation().errorMessage_ = "Error: " + CommandExecutor::getArgument(0) + " " + GetLocalisation("commandexecutorunknownfirstargument") + ".";
@@ -238,5 +238,5 @@
                             CommandExecutor::getEvaluation().bCommandChanged_ = true;
                         }
-                        CommandExecutor::getEvaluation().state_ = CS_ParamPreparation;
+                        CommandExecutor::getEvaluation().state_ = CommandState::ParamPreparation;
                         CommandExecutor::getEvaluation().functionclass_ = 0;
                         CommandExecutor::getEvaluation().command_ = CommandExecutor::getEvaluation().function_->getName();
@@ -258,5 +258,5 @@
                             CommandExecutor::getEvaluation().bCommandChanged_ = true;
                         }
-                        CommandExecutor::getEvaluation().state_ = CS_Function;
+                        CommandExecutor::getEvaluation().state_ = CommandState::Function;
                         CommandExecutor::getEvaluation().function_ = 0;
                         CommandExecutor::getEvaluation().command_ = CommandExecutor::getEvaluation().functionclass_->getName() + " ";
@@ -266,5 +266,5 @@
                     {
                         // No possibilities
-                        CommandExecutor::getEvaluation().state_ = CS_Error;
+                        CommandExecutor::getEvaluation().state_ = CommandState::Error;
                         AddLanguageEntry("commandexecutorunknownfirstargumentstart", "There is no command or classname starting with");
                         CommandExecutor::getEvaluation().errorMessage_ = "Error: " + GetLocalisation("commandexecutorunknownfirstargumentstart") + " " + CommandExecutor::getArgument(0) + ".";
@@ -285,5 +285,5 @@
                 }
             }
-            case CS_Function:
+            case CommandState::Function:
             {
                 if (CommandExecutor::getEvaluation().functionclass_)
@@ -298,5 +298,5 @@
                         {
                             // It's a function
-                            CommandExecutor::getEvaluation().state_ = CS_ParamPreparation;
+                            CommandExecutor::getEvaluation().state_ = CommandState::ParamPreparation;
                             // Move on to next case
                         }
@@ -304,5 +304,5 @@
                         {
                             // The second argument is bad
-                            CommandExecutor::getEvaluation().state_ = CS_Error;
+                            CommandExecutor::getEvaluation().state_ = CommandState::Error;
                             AddLanguageEntry("commandexecutorunknownsecondargument", "is not a function of");
                             CommandExecutor::getEvaluation().errorMessage_ = "Error: " + CommandExecutor::getArgument(1) + " " + GetLocalisation("commandexecutorunknownsecondargument") + " " + CommandExecutor::getEvaluation().functionclass_->getName() + ".";
@@ -326,5 +326,5 @@
                                 CommandExecutor::getEvaluation().bCommandChanged_ = true;
                             }
-                            CommandExecutor::getEvaluation().state_ = CS_ParamPreparation;
+                            CommandExecutor::getEvaluation().state_ = CommandState::ParamPreparation;
                             CommandExecutor::getEvaluation().command_ = CommandExecutor::getEvaluation().functionclass_->getName() + " " + CommandExecutor::getEvaluation().function_->getName();
                             if (CommandExecutor::getEvaluation().function_->getParamCount() > 0)
@@ -338,5 +338,5 @@
                         {
                             // No possibilities
-                            CommandExecutor::getEvaluation().state_ = CS_Error;
+                            CommandExecutor::getEvaluation().state_ = CommandState::Error;
                             AddLanguageEntry("commandexecutorunknownsecondargumentstart", "has no function starting with");
                             CommandExecutor::getEvaluation().errorMessage_ = "Error: " + CommandExecutor::getEvaluation().functionclass_->getName() + " " + GetLocalisation("commandexecutorunknownsecondargumentstart") + " " + CommandExecutor::getArgument(1) + ".";
@@ -355,12 +355,12 @@
                 else
                 {
-                    // There is no classname - move on to CS_ParamPreparation
-                }
-            }
-            case CS_ParamPreparation:
+                    // There is no classname - move on to CommandState::ParamPreparation
+                }
+            }
+            case CommandState::ParamPreparation:
             {
                 if (CommandExecutor::getEvaluation().function_->getParamCount() == 0 || CommandExecutor::enoughArgumentsGiven(CommandExecutor::getEvaluation().function_))
                 {
-                    CommandExecutor::getEvaluation().state_ = CS_Finished;
+                    CommandExecutor::getEvaluation().state_ = CommandState::Finished;
                     return;
                 }
@@ -372,5 +372,5 @@
 
                     CommandExecutor::createListOfPossibleArguments(CommandExecutor::getLastArgument(), CommandExecutor::getEvaluation().function_, argumentNumber);
-                    CommandExecutor::getEvaluation().state_ = CS_Params;
+                    CommandExecutor::getEvaluation().state_ = CommandState::Params;
 
                     if (CommandExecutor::getEvaluation().bCommandChanged_)
@@ -381,5 +381,5 @@
                 }
             }
-            case CS_Params:
+            case CommandState::Params:
             {
                 if (CommandExecutor::getEvaluation().listOfPossibleArguments_.size() == 1)
@@ -388,5 +388,5 @@
                     CommandExecutor::getEvaluation().argument_ = (*CommandExecutor::getEvaluation().listOfPossibleArguments_.begin()).getString();
                     CommandExecutor::getEvaluation().possibleArgument_ = (*CommandExecutor::getEvaluation().listOfPossibleArguments_.begin()).getString();
-                    CommandExecutor::getEvaluation().state_ = CS_ParamPreparation;
+                    CommandExecutor::getEvaluation().state_ = CommandState::ParamPreparation;
                     return;
                 }
@@ -394,5 +394,5 @@
                 {
                     // The user tries something new - we let him do
-                    CommandExecutor::getEvaluation().state_ = CS_ParamPreparation;
+                    CommandExecutor::getEvaluation().state_ = CommandState::ParamPreparation;
                     CommandExecutor::getEvaluation().argument_ = CommandExecutor::getLastArgument();
                     return;
@@ -409,14 +409,14 @@
                     CommandExecutor::getEvaluation().argument_ = CommandExecutor::getCommonBegin(CommandExecutor::getEvaluation().listOfPossibleArguments_);
                     CommandExecutor::getEvaluation().possibleArgument_ = CommandExecutor::getPossibleArgument(CommandExecutor::getLastArgument(), CommandExecutor::getEvaluation().function_, argumentNumber);
-                    CommandExecutor::getEvaluation().state_ = CS_ParamPreparation;
+                    CommandExecutor::getEvaluation().state_ = CommandState::ParamPreparation;
                     return;
                 }
             }
-            case CS_Finished:
+            case CommandState::Finished:
             {
                 // Nothing more to do
                 break;
             }
-            case CS_Error:
+            case CommandState::Error:
             {
                 // Bad, very bad
Index: code/trunk/src/core/CommandLine.cc
===================================================================
--- code/trunk/src/core/CommandLine.cc	(revision 3279)
+++ code/trunk/src/core/CommandLine.cc	(revision 3280)
@@ -29,4 +29,6 @@
 #include "CommandLine.h"
 
+#include <algorithm>
+#include <sstream>
 #include <boost/filesystem.hpp>
 
@@ -34,5 +36,5 @@
 #include "util/Debug.h"
 #include "util/Exception.h"
-#include "util/String.h"
+#include "util/StringUtils.h"
 #include "util/SubString.h"
 #include "Core.h"
@@ -40,5 +42,5 @@
 namespace orxonox
 {
-    SetCommandLineArgument(optionsFile, "start.ini").shortcut("o");
+    SetCommandLineOnlyArgument(optionsFile, "start.ini").shortcut("o");
 
     /**
@@ -49,7 +51,9 @@
         so that you can have simple command line switches.
     */
-    void CommandLineArgument::parse(const std::string& value)
-    {
-        if (value_.getType() == MT_bool)
+    void CommandLineArgument::parse(const std::string& value, bool bParsingFile)
+    {
+        if (bParsingFile && this->bCommandLineOnly_)
+            ThrowException(Argument, "Command line argument '" + getName() + "' is not allowed in files.");
+        if (value_.getType() == MT_Type::Bool)
         {
             // simulate command line switch
@@ -66,7 +70,5 @@
             }
             else
-            {
                 ThrowException(Argument, "Could not read command line argument '" + getName() + "'.");
-            }
         }
         else
@@ -126,102 +128,111 @@
         Vector of space separated strings.
     */
-    void CommandLine::_parse(const std::vector<std::string>& arguments)
-    {
-        // why this? See bFirstTimeParse_ declaration.
-        if (bFirstTimeParse_)
-        {
-            // first shove all the shortcuts in a map
-            for (std::map<std::string, CommandLineArgument*>::const_iterator it = cmdLineArgs_.begin();
-                it != cmdLineArgs_.end(); ++it)
-            {
-                OrxAssert(cmdLineArgsShortcut_.find(it->second->getShortcut()) == cmdLineArgsShortcut_.end(),
-                    "Cannot have two command line shortcut with the same name.");
-                if (it->second->getShortcut() != "")
-                    cmdLineArgsShortcut_[it->second->getShortcut()] = it->second;
-            }
-            bFirstTimeParse_ = false;
-        }
-
-        std::string name;
-        std::string shortcut;
-        std::string value;
-        for (unsigned int i = 0; i < arguments.size(); ++i)
-        {
-            if (arguments[i].size() != 0)
-            {
-                // sure not ""
-                if (arguments[i][0] == '-')
+    void CommandLine::_parse(const std::vector<std::string>& arguments, bool bParsingFile)
+    {
+        try
+        {
+            // why this? See bFirstTimeParse_ declaration.
+            if (bFirstTimeParse_)
+            {
+                // first shove all the shortcuts in a map
+                for (std::map<std::string, CommandLineArgument*>::const_iterator it = cmdLineArgs_.begin();
+                    it != cmdLineArgs_.end(); ++it)
                 {
-                    // start with "-"
-                    if (arguments[i].size() == 1)
+                    OrxAssert(cmdLineArgsShortcut_.find(it->second->getShortcut()) == cmdLineArgsShortcut_.end(),
+                        "Cannot have two command line shortcut with the same name.");
+                    if (it->second->getShortcut() != "")
+                        cmdLineArgsShortcut_[it->second->getShortcut()] = it->second;
+                }
+                bFirstTimeParse_ = false;
+            }
+
+            std::string name;
+            std::string shortcut;
+            std::string value;
+            for (unsigned int i = 0; i < arguments.size(); ++i)
+            {
+                if (arguments[i].size() != 0)
+                {
+                    // sure not ""
+                    if (arguments[i][0] == '-')
                     {
-                        // argument[i] is "-", probably a minus sign
-                        value += "- ";
-                    }
-                    else if (arguments[i][1] <= 57 && arguments[i][1] >= 48)
-                    {
-                        // negative number as a value
-                        value += arguments[i] + " ";
+                        // start with "-"
+                        if (arguments[i].size() == 1)
+                        {
+                            // argument[i] is "-", probably a minus sign
+                            value += "- ";
+                        }
+                        else if (arguments[i][1] <= 57 && arguments[i][1] >= 48)
+                        {
+                            // negative number as a value
+                            value += arguments[i] + " ";
+                        }
+                        else
+                        {
+                            // can be shortcut or full name argument
+
+                            // save old data first
+                            value = removeTrailingWhitespaces(value);
+                            if (name != "")
+                            {
+                                checkFullArgument(name, value, bParsingFile);
+                                name = "";
+                                assert(shortcut == "");
+                            }
+                            else if (shortcut != "")
+                            {
+                                checkShortcut(shortcut, value, bParsingFile);
+                                shortcut = "";
+                                assert(name == "");
+                            }
+
+                            if (arguments[i][1] == '-')
+                            {
+                                // full name argument with "--name"
+                                name = arguments[i].substr(2);
+                            }
+                            else
+                            {
+                                // shortcut with "-s"
+                                shortcut = arguments[i].substr(1);
+                            }
+
+                            // reset value string
+                            value = "";
+                        }
                     }
                     else
                     {
-                        // can be shortcut or full name argument
-
-                        // save old data first
-                        value = removeTrailingWhitespaces(value);
-                        if (name != "")
+                        // value string
+
+                        if (name == "" && shortcut == "")
                         {
-                            checkFullArgument(name, value);
-                            name = "";
-                            assert(shortcut == "");
+                            ThrowException(Argument, "Expected \"-\" or \"-\" in command line arguments.\n");
                         }
-                        else if (shortcut != "")
-                        {
-                            checkShortcut(shortcut, value);
-                            shortcut = "";
-                            assert(name == "");
-                        }
-
-                        if (arguments[i][1] == '-')
-                        {
-                            // full name argument with "--name"
-                            name = arguments[i].substr(2);
-                        }
-                        else
-                        {
-                            // shortcut with "-s"
-                            shortcut = arguments[i].substr(1);
-                        }
-
-                        // reset value string
-                        value = "";
+
+                        // Concatenate strings as long as there's no new argument by "-" or "--"
+                        value += arguments[i] + ' ';
                     }
                 }
-                else
-                {
-                    // value string
-
-                    if (name == "" && shortcut == "")
-                    {
-                        ThrowException(Argument, "Expected \"-\" or \"-\" in command line arguments.\n");
-                    }
-
-                    // Concatenate strings as long as there's no new argument by "-" or "--"
-                    value += arguments[i] + ' ';
-                }
-            }
-        }
-
-        // parse last argument
-        value = removeTrailingWhitespaces(value);
-        if (name != "")
-        {
-            checkFullArgument(name, value);
-            assert(shortcut == "");
-        }
-        else if (shortcut != "")
-        {
-            checkShortcut(shortcut, value);
-            assert(name == "");
+            }
+
+            // parse last argument
+            value = removeTrailingWhitespaces(value);
+            if (name != "")
+            {
+                checkFullArgument(name, value, bParsingFile);
+                assert(shortcut == "");
+            }
+            else if (shortcut != "")
+            {
+                checkShortcut(shortcut, value, bParsingFile);
+                assert(name == "");
+            }
+        }
+        catch (const ArgumentException& ex)
+        {
+            COUT(0) << "Could not parse command line (including additional files): " << ex.what() << std::endl;
+            COUT(0) << CommandLine::getUsageInformation() << std::endl;
+            throw GeneralException("");
         }
     }
@@ -235,5 +246,5 @@
         String containing the value
     */
-    void CommandLine::checkFullArgument(const std::string& name, const std::string& value)
+    void CommandLine::checkFullArgument(const std::string& name, const std::string& value, bool bParsingFile)
     {
         std::map<std::string, CommandLineArgument*>::const_iterator it = cmdLineArgs_.find(name);
@@ -241,5 +252,5 @@
             ThrowException(Argument, "Command line argument '" + name + "' does not exist.");
 
-        it->second->parse(value);
+        it->second->parse(value, bParsingFile);
     }
 
@@ -252,5 +263,5 @@
         String containing the value
     */
-    void CommandLine::checkShortcut(const std::string& shortcut, const std::string& value)
+    void CommandLine::checkShortcut(const std::string& shortcut, const std::string& value, bool bParsingFile)
     {
         std::map<std::string, CommandLineArgument*>::const_iterator it = cmdLineArgsShortcut_.find(shortcut);
@@ -258,17 +269,41 @@
             ThrowException(Argument, "Command line shortcut '" + shortcut + "' does not exist.");
 
-        it->second->parse(value);
+        it->second->parse(value, bParsingFile);
     }
 
     std::string CommandLine::getUsageInformation()
     {
-        CommandLine* inst = &_getInstance();
-        std::string infoStr;
-        for (std::map<std::string, CommandLineArgument*>::const_iterator it = inst->cmdLineArgs_.begin();
-            it != inst->cmdLineArgs_.end(); ++it)
-        {
-            infoStr += "[--" + it->second->getName() + " " + it->second->getInformation() + "] ";
-        }
-        return infoStr;
+        CommandLine& inst = _getInstance();
+        std::ostringstream infoStr;
+
+        // determine maximum name size
+        size_t maxNameSize = 0;
+        for (std::map<std::string, CommandLineArgument*>::const_iterator it = inst.cmdLineArgs_.begin();
+            it != inst.cmdLineArgs_.end(); ++it)
+        {
+            maxNameSize = std::max(it->second->getName().size(), maxNameSize);
+        }
+
+        infoStr << "Usage: orxonox [options]" << std::endl;
+        infoStr << "Available options:" << std::endl;
+
+        for (std::map<std::string, CommandLineArgument*>::const_iterator it = inst.cmdLineArgs_.begin();
+            it != inst.cmdLineArgs_.end(); ++it)
+        {
+            if (it->second->getShortcut() != "")
+                infoStr << " [-" << it->second->getShortcut() << "] ";
+            else
+                infoStr << "      ";
+            infoStr << "--" << it->second->getName() << " ";
+            if (it->second->getValue().getType() != MT_Type::Bool)
+                infoStr << "ARG ";
+            else
+                infoStr << "    ";
+            // fill with the necessary amount of blanks
+            infoStr << std::string(maxNameSize - it->second->getName().size(), ' ');
+            infoStr << ": " << it->second->getInformation();
+            infoStr << std::endl;
+        }
+        return infoStr.str();
     }
 
@@ -295,14 +330,20 @@
     /**
     @brief
-        Parses both command line and start.ini for CommandLineArguments.
-    */
-    void CommandLine::_parseAll(int argc, char** argv)
-    {
-        // parse command line first
+        Parses only the command line for CommandLineArguments.
+    */
+    void CommandLine::_parseCommandLine(int argc, char** argv)
+    {
         std::vector<std::string> args;
         for (int i = 1; i < argc; ++i)
             args.push_back(argv[i]);
-        this->_parse(args);
-
+        this->_parse(args, false);
+    }
+
+    /**
+    @brief
+        Parses start.ini (or the file specified with --optionsFile) for CommandLineArguments.
+    */
+    void CommandLine::_parseFile()
+    {
         std::string filename = CommandLine::getValue("optionsFile").getString();
         boost::filesystem::path filepath(Core::getConfigPath() / filename);
@@ -312,5 +353,5 @@
         std::ifstream file;
         file.open(filepath.string().c_str());
-        args.clear();
+        std::vector<std::string> args;
         if (file)
         {
@@ -332,13 +373,5 @@
         }
 
-        try
-        {
-            _parse(args);
-        }
-        catch (orxonox::ArgumentException& ex)
-        {
-            COUT(1) << "An Exception occured while parsing " << filename << std::endl;
-            throw(ex);
-        }
+        _parse(args, true);
     }
 }
Index: code/trunk/src/core/CommandLine.h
===================================================================
--- code/trunk/src/core/CommandLine.h	(revision 3279)
+++ code/trunk/src/core/CommandLine.h	(revision 3280)
@@ -38,8 +38,14 @@
 #define SetCommandLineArgument(name, defaultValue) \
     orxonox::CommandLineArgument& CmdArgumentDummyBoolVar##name \
-    = orxonox::CommandLine::addArgument(#name, defaultValue)
+    = orxonox::CommandLine::addArgument(#name, defaultValue, false)
+#define SetCommandLineOnlyArgument(name, defaultValue) \
+    orxonox::CommandLineArgument& CmdArgumentDummyBoolVar##name \
+    = orxonox::CommandLine::addArgument(#name, defaultValue, true)
 #define SetCommandLineSwitch(name) \
     orxonox::CommandLineArgument& CmdArgumentDummyBoolVar##name \
-    = orxonox::CommandLine::addArgument(#name, false)
+    = orxonox::CommandLine::addArgument(#name, false, false)
+#define SetCommandLineOnlySwitch(name) \
+    orxonox::CommandLineArgument& CmdArgumentDummyBoolVar##name \
+    = orxonox::CommandLine::addArgument(#name, false, true)
 
 
@@ -74,5 +80,5 @@
 
         //! Returns the shortcut (example: "-p 22" for "--port 22") of the argument.
-        //! Evaluates to "" if none there is none.
+        //! Evaluates to "" if there is none.
         const std::string& getShortcut() const { return shortcut_; }
         //! Sets the shortcut for the argument
@@ -93,9 +99,10 @@
     private:
         //! Constructor initialises both value_ and defaultValue_ with defaultValue.
-        CommandLineArgument(const std::string& name, const MultiType& defaultValue)
+        CommandLineArgument(const std::string& name, const MultiType& defaultValue, bool bCommandLineOnly)
             : bHasDefaultValue_(true)
             , name_(name)
             , value_(defaultValue)
             , defaultValue_(defaultValue)
+            , bCommandLineOnly_(bCommandLineOnly)
         { }
 
@@ -105,5 +112,5 @@
 
         //! Parses the value string of a command line argument.
-        void parse(const std::string& value);
+        void parse(const std::string& value, bool bParsingFile);
 
         //! Tells whether the value has been changed by the command line.
@@ -115,6 +122,7 @@
         std::string usageInformation_; //!< Tells about the usage of this parameter
 
-        MultiType value_;            //!< The actual value
-        MultiType defaultValue_;     //!< Default value. Should not be changed.
+        MultiType   value_;            //!< The actual value
+        MultiType   defaultValue_;     //!< Default value. Should not be changed.
+        bool        bCommandLineOnly_; //!< Whether you cannot specify the value in a text file
     };
 
@@ -134,5 +142,6 @@
 
         //! Parse redirection to internal member method.
-        static void parseAll(int argc, char** argv) { _getInstance()._parseAll(argc, argv); }
+        static void parseCommandLine(int argc, char** argv) { _getInstance()._parseCommandLine(argc, argv); }
+        static void parseFile() { _getInstance()._parseFile(); }
 
         static std::string getUsageInformation();
@@ -146,5 +155,5 @@
         { return getArgument(name)->getValue(); }
         template <class T>
-        static CommandLineArgument& addArgument(const std::string& name, T defaultValue);
+        static CommandLineArgument& addArgument(const std::string& name, T defaultValue, bool bCommandLineOnly);
 
         static bool existsArgument(const std::string& name)
@@ -165,8 +174,9 @@
         static CommandLine& _getInstance();
 
-        void _parseAll(int argc, char** argv);
-        void _parse(const std::vector<std::string>& arguments);
-        void checkFullArgument(const std::string& name, const std::string& value);
-        void checkShortcut(const std::string& shortcut, const std::string& value);
+        void _parseCommandLine(int argc, char** argv);
+        void _parseFile();
+        void _parse(const std::vector<std::string>& arguments, bool bParsingFile);
+        void checkFullArgument(const std::string& name, const std::string& value, bool bParsingFile);
+        void checkShortcut(const std::string& shortcut, const std::string& value, bool bParsingFile);
 
         /**
@@ -199,10 +209,13 @@
     */
     template <class T>
-    CommandLineArgument& CommandLine::addArgument(const std::string& name, T defaultValue)
+    CommandLineArgument& CommandLine::addArgument(const std::string& name, T defaultValue, bool bCommandLineOnly)
     {
         OrxAssert(!_getInstance().existsArgument(name),
             "Cannot add a command line argument with name '" + name + "' twice.");
-
-        return *(_getInstance().cmdLineArgs_[name] = new CommandLineArgument(name, defaultValue));
+        OrxAssert(MultiType(defaultValue).getType() != MT_Type::Bool || MultiType(defaultValue).getBool() != true,
+               "Boolean command line arguments with positive default values are not supported." << std::endl
+            << "Please use SetCommandLineSwitch and adjust your argument: " << name);
+
+        return *(_getInstance().cmdLineArgs_[name] = new CommandLineArgument(name, defaultValue, bCommandLineOnly));
     }
 }
Index: code/trunk/src/core/ConfigFileManager.cc
===================================================================
--- code/trunk/src/core/ConfigFileManager.cc	(revision 3279)
+++ code/trunk/src/core/ConfigFileManager.cc	(revision 3280)
@@ -33,5 +33,5 @@
 #include "util/Convert.h"
 #include "util/Math.h"
-#include "util/String.h"
+#include "util/StringUtils.h"
 #include "ConsoleCommand.h"
 #include "ConfigValueContainer.h"
@@ -124,7 +124,7 @@
     {
         if (this->additionalComment_ == "" || this->additionalComment_.size() == 0)
-            return (this->name_ + "[" + getConvertedValue<unsigned int, std::string>(this->index_, "0") + "]" + "=" + this->value_);
-        else
-            return (this->name_ + "[" + getConvertedValue<unsigned int, std::string>(this->index_, "0") + "]=" + this->value_ + " " + this->additionalComment_);
+            return (this->name_ + "[" + multi_cast<std::string>(this->index_) + "]" + "=" + this->value_);
+        else
+            return (this->name_ + "[" + multi_cast<std::string>(this->index_) + "]=" + this->value_ + " " + this->additionalComment_);
     }
 
Index: code/trunk/src/core/ConfigValueContainer.cc
===================================================================
--- code/trunk/src/core/ConfigValueContainer.cc	(revision 3279)
+++ code/trunk/src/core/ConfigValueContainer.cc	(revision 3280)
@@ -78,5 +78,5 @@
         for (unsigned int i = 0; i < this->valueVector_.size(); i++)
         {
-            ConfigFileManager::getInstance().getValue(this->type_, this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.isType(MT_string));
+            ConfigFileManager::getInstance().getValue(this->type_, this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.isType(MT_Type::String));
             this->defvalueStringVector_.push_back(this->valueVector_[i]);
         }
@@ -109,5 +109,5 @@
             if (this->tset(input))
             {
-                ConfigFileManager::getInstance().setValue(this->type_, this->sectionname_, this->varname_, input, this->value_.isType(MT_string));
+                ConfigFileManager::getInstance().setValue(this->type_, this->sectionname_, this->varname_, input, this->value_.isType(MT_Type::String));
                 return true;
             }
@@ -128,5 +128,5 @@
             if (this->tset(index, input))
             {
-                ConfigFileManager::getInstance().setValue(this->type_, this->sectionname_, this->varname_, index, input, this->value_.isType(MT_string));
+                ConfigFileManager::getInstance().setValue(this->type_, this->sectionname_, this->varname_, index, input, this->value_.isType(MT_Type::String));
                 return true;
             }
@@ -228,5 +228,5 @@
                 this->valueVector_.erase(this->valueVector_.begin() + index);
                 for (unsigned int i = index; i < this->valueVector_.size(); i++)
-                    ConfigFileManager::getInstance().setValue(this->type_, this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.isType(MT_string));
+                    ConfigFileManager::getInstance().setValue(this->type_, this->sectionname_, this->varname_, i, this->valueVector_[i], this->value_.isType(MT_Type::String));
                 ConfigFileManager::getInstance().deleteVectorEntries(this->type_, this->sectionname_, this->varname_, this->valueVector_.size());
 
@@ -264,5 +264,5 @@
     {
         if (!this->bIsVector_)
-            this->value_ = ConfigFileManager::getInstance().getValue(this->type_, this->sectionname_, this->varname_, this->defvalueString_, this->value_.isType(MT_string));
+            this->value_ = ConfigFileManager::getInstance().getValue(this->type_, this->sectionname_, this->varname_, this->defvalueString_, this->value_.isType(MT_Type::String));
         else
         {
@@ -273,9 +273,9 @@
                 if (i < this->defvalueStringVector_.size())
                 {
-                    this->value_ = ConfigFileManager::getInstance().getValue(this->type_, this->sectionname_, this->varname_, i, this->defvalueStringVector_[i], this->value_.isType(MT_string));
+                    this->value_ = ConfigFileManager::getInstance().getValue(this->type_, this->sectionname_, this->varname_, i, this->defvalueStringVector_[i], this->value_.isType(MT_Type::String));
                 }
                 else
                 {
-                    this->value_ = ConfigFileManager::getInstance().getValue(this->type_, this->sectionname_, this->varname_, i, MultiType(), this->value_.isType(MT_string));
+                    this->value_ = ConfigFileManager::getInstance().getValue(this->type_, this->sectionname_, this->varname_, i, MultiType(), this->value_.isType(MT_Type::String));
                 }
 
Index: code/trunk/src/core/ConfigValueIncludes.h
===================================================================
--- code/trunk/src/core/ConfigValueIncludes.h	(revision 3279)
+++ code/trunk/src/core/ConfigValueIncludes.h	(revision 3280)
@@ -52,5 +52,5 @@
     if (!container##varname) \
     { \
-        container##varname = new orxonox::ConfigValueContainer(ConfigFileType::Settings, identifier##varname, identifier##varname->getName(), #varname, defvalue, varname); \
+        container##varname = new orxonox::ConfigValueContainer(type, identifier##varname, identifier##varname->getName(), #varname, defvalue, varname); \
         identifier##varname->addConfigValueContainer(#varname, container##varname); \
     } \
@@ -70,5 +70,5 @@
     if (!container##varname) \
     { \
-        container##varname = new orxonox::ConfigValueContainer(ConfigFileType::Settings, identifier##varname, identifier##varname->getName(), #varname, defvalue); \
+        container##varname = new orxonox::ConfigValueContainer(type, identifier##varname, identifier##varname->getName(), #varname, defvalue); \
         identifier##varname->addConfigValueContainer(#varname, container##varname); \
     } \
Index: code/trunk/src/core/ConsoleCommand.h
===================================================================
--- code/trunk/src/core/ConsoleCommand.h	(revision 3279)
+++ code/trunk/src/core/ConsoleCommand.h	(revision 3280)
@@ -71,5 +71,5 @@
     namespace AccessLevel
     {
-        enum Level
+        enum Value
         {
             None,
@@ -106,7 +106,7 @@
                 { this->Executor::setDefaultValue(index, param); return (*this); }
 
-            inline ConsoleCommand& accessLevel(AccessLevel::Level level)
+            inline ConsoleCommand& accessLevel(AccessLevel::Value level)
                 { this->accessLevel_ = level; return (*this); }
-            inline AccessLevel::Level getAccessLevel() const
+            inline AccessLevel::Value getAccessLevel() const
                 { return this->accessLevel_; }
 
@@ -130,7 +130,7 @@
             }
 
-            inline ConsoleCommand& keybindMode(KeybindMode::Enum mode)
+            inline ConsoleCommand& keybindMode(KeybindMode::Value mode)
                 { this->keybindMode_ = mode; return *this; }
-            inline KeybindMode::Enum getKeybindMode() const
+            inline KeybindMode::Value getKeybindMode() const
                 { return this->keybindMode_; }
 
@@ -141,9 +141,9 @@
 
         private:
-            AccessLevel::Level accessLevel_;
+            AccessLevel::Value accessLevel_;
             ArgumentCompleter* argumentCompleter_[5];
             ArgumentCompletionList argumentList_;
 
-            KeybindMode::Enum keybindMode_;
+            KeybindMode::Value keybindMode_;
             int inputConfiguredParam_;
     };
Index: code/trunk/src/core/Core.cc
===================================================================
--- code/trunk/src/core/Core.cc	(revision 3279)
+++ code/trunk/src/core/Core.cc	(revision 3280)
@@ -77,40 +77,193 @@
 namespace orxonox
 {
-    //! Path to the parent directory of the ones above if program was installed with relativ pahts
-    static boost::filesystem::path rootPath_g;
-    static boost::filesystem::path executablePath_g;            //!< Path to the executable
-    static boost::filesystem::path mediaPath_g;                 //!< Path to the media file folder
-    static boost::filesystem::path configPath_g;                //!< Path to the config file folder
-    static boost::filesystem::path logPath_g;                   //!< Path to the log file folder
-
     //! Static pointer to the singleton
     Core* Core::singletonRef_s  = 0;
 
-    SetCommandLineArgument(mediaPath, "").information("PATH");
-    SetCommandLineArgument(writingPathSuffix, "").information("DIR");
-    SetCommandLineArgument(settingsFile, "orxonox.ini");
-    SetCommandLineArgument(limitToCPU, 0).information("0: off | #cpu");
-
-    Core::Core()
-    {
-        RegisterRootObject(Core);
-
-        assert(Core::singletonRef_s == 0);
+    SetCommandLineArgument(mediaPath, "").information("Path to the media/data files");
+    SetCommandLineOnlyArgument(writingPathSuffix, "").information("Additional subfolder for config and log files");
+    SetCommandLineArgument(settingsFile, "orxonox.ini").information("THE configuration file");
+#ifdef ORXONOX_PLATFORM_WINDOWS
+    SetCommandLineArgument(limitToCPU, 0).information("Limits the program to one cpu/core (1, 2, 3, etc.). 0 turns it off (default)");
+#endif
+
+    /**
+    @brief
+        Helper class for the Core singleton: we cannot derive
+        Core from OrxonoxClass because we need to handle the Identifier
+        destruction in the Core destructor.
+    */
+    class CoreConfiguration : public OrxonoxClass
+    {
+    public:
+        CoreConfiguration()
+        {
+        }
+
+        void initialise()
+        {
+            RegisterRootObject(CoreConfiguration);
+            this->setConfigValues();
+
+            // Possible media path override by the command line
+            if (!CommandLine::getArgument("mediaPath")->hasDefaultValue())
+                tsetMediaPath(CommandLine::getValue("mediaPath"));
+        }
+
+        /**
+            @brief Function to collect the SetConfigValue-macro calls.
+        */
+        void setConfigValues()
+        {
+#ifdef NDEBUG
+            const unsigned int defaultLevelConsole = 1;
+            const unsigned int defaultLevelLogfile = 3;
+            const unsigned int defaultLevelShell   = 1;
+#else
+            const unsigned int defaultLevelConsole = 3;
+            const unsigned int defaultLevelLogfile = 4;
+            const unsigned int defaultLevelShell   = 3;
+#endif
+            SetConfigValue(softDebugLevelConsole_, defaultLevelConsole)
+                .description("The maximal level of debug output shown in the console")
+                .callback(this, &CoreConfiguration::debugLevelChanged);
+            SetConfigValue(softDebugLevelLogfile_, defaultLevelLogfile)
+                .description("The maximal level of debug output shown in the logfile")
+                .callback(this, &CoreConfiguration::debugLevelChanged);
+            SetConfigValue(softDebugLevelShell_, defaultLevelShell)
+                .description("The maximal level of debug output shown in the ingame shell")
+                .callback(this, &CoreConfiguration::debugLevelChanged);
+
+            SetConfigValue(language_, Language::getLanguage().defaultLanguage_)
+                .description("The language of the ingame text")
+                .callback(this, &CoreConfiguration::languageChanged);
+            SetConfigValue(bInitializeRandomNumberGenerator_, true)
+                .description("If true, all random actions are different each time you start the game")
+                .callback(this, &CoreConfiguration::initializeRandomNumberGenerator);
+
+            SetConfigValue(mediaPathString_, mediaPath_.string())
+                .description("Relative path to the game data.")
+                .callback(this, &CoreConfiguration::mediaPathChanged);
+        }
+
+        /**
+            @brief Callback function if the debug level has changed.
+        */
+        void debugLevelChanged()
+        {
+            // softDebugLevel_ is the maximum of the 3 variables
+            this->softDebugLevel_ = this->softDebugLevelConsole_;
+            if (this->softDebugLevelLogfile_ > this->softDebugLevel_)
+                this->softDebugLevel_ = this->softDebugLevelLogfile_;
+            if (this->softDebugLevelShell_ > this->softDebugLevel_)
+                this->softDebugLevel_ = this->softDebugLevelShell_;
+
+            OutputHandler::setSoftDebugLevel(OutputHandler::LD_All,     this->softDebugLevel_);
+            OutputHandler::setSoftDebugLevel(OutputHandler::LD_Console, this->softDebugLevelConsole_);
+            OutputHandler::setSoftDebugLevel(OutputHandler::LD_Logfile, this->softDebugLevelLogfile_);
+            OutputHandler::setSoftDebugLevel(OutputHandler::LD_Shell,   this->softDebugLevelShell_);
+        }
+
+        /**
+            @brief Callback function if the language has changed.
+        */
+        void languageChanged()
+        {
+            // Read the translation file after the language was configured
+            Language::getLanguage().readTranslatedLanguageFile();
+        }
+
+        /**
+        @brief
+            Callback function if the media path has changed.
+        */
+        void mediaPathChanged()
+        {
+            mediaPath_ = boost::filesystem::path(this->mediaPathString_);
+        }
+
+        /**
+            @brief Sets the language in the config-file back to the default.
+        */
+        void resetLanguage()
+        {
+            ResetConfigValue(language_);
+        }
+
+        /**
+        @brief
+            Temporary sets the media path
+        @param path
+            The new media path
+        */
+        void tsetMediaPath(const std::string& path)
+        {
+            ModifyConfigValue(mediaPathString_, tset, path);
+        }
+
+        void initializeRandomNumberGenerator()
+        {
+            static bool bInitialized = false;
+            if (!bInitialized && this->bInitializeRandomNumberGenerator_)
+            {
+                srand(static_cast<unsigned int>(time(0)));
+                rand();
+                bInitialized = true;
+            }
+        }
+
+        int softDebugLevel_;                            //!< The debug level
+        int softDebugLevelConsole_;                     //!< The debug level for the console
+        int softDebugLevelLogfile_;                     //!< The debug level for the logfile
+        int softDebugLevelShell_;                       //!< The debug level for the ingame shell
+        std::string language_;                          //!< The language
+        bool bInitializeRandomNumberGenerator_;         //!< If true, srand(time(0)) is called
+        std::string mediaPathString_;                   //!< Path to the data/media file folder as string
+
+        //! Path to the parent directory of the ones above if program was installed with relativ pahts
+        boost::filesystem::path rootPath_;
+        boost::filesystem::path executablePath_;        //!< Path to the executable
+        boost::filesystem::path mediaPath_;             //!< Path to the media file folder
+        boost::filesystem::path configPath_;            //!< Path to the config file folder
+        boost::filesystem::path logPath_;               //!< Path to the log file folder
+    };
+
+
+    Core::Core(int argc, char** argv)
+    {
+        if (singletonRef_s != 0)
+        {
+            COUT(0) << "Error: The Core singleton cannot be recreated! Shutting down." << std::endl;
+            abort();
+        }
         Core::singletonRef_s = this;
-    }
-
-    void Core::initialise(int argc, char** argv)
-    {
-        // Parse command line arguments fist
-        try
-        {
-            CommandLine::parseAll(argc, argv);
-        }
-        catch (ArgumentException& ex)
-        {
-            COUT(1) << ex.what() << std::endl;
-            COUT(0) << "Usage:" << std::endl << "orxonox " << CommandLine::getUsageInformation() << std::endl;
-        }
-
+
+        // We need the variables very soon. But don't configure them yet!
+        this->configuration_ = new CoreConfiguration();
+
+        // Parse command line arguments first
+        CommandLine::parseCommandLine(argc, argv);
+
+        // Determine and set the location of the executable
+        setExecutablePath();
+
+        // Determine whether we have an installed or a binary dir run
+        // The latter occurs when simply running from the build directory
+        checkDevBuild();
+
+        // Make sure the directories we write in exist or else make them
+        createDirectories();
+
+        // create a signal handler (only active for linux)
+        // This call is placed as soon as possible, but after the directories are set
+        this->signalHandler_ = new SignalHandler();
+        this->signalHandler_->doCatch(configuration_->executablePath_.string(), Core::getLogPathString() + "orxonox_crash.log");
+
+        // Set the correct log path. Before this call, /tmp (Unix) or %TEMP% was used
+        OutputHandler::getOutStream().setLogPath(Core::getLogPathString());
+
+        // Parse additional options file now that we know its path
+        CommandLine::parseFile();
+
+#ifdef ORXONOX_PLATFORM_WINDOWS
         // limit the main thread to the first core so that QueryPerformanceCounter doesn't jump
         // do this after ogre has initialised. Somehow Ogre changes the settings again (not through
@@ -118,23 +271,6 @@
         int limitToCPU = CommandLine::getValue("limitToCPU");
         if (limitToCPU > 0)
-            setThreadAffinity((unsigned int)limitToCPU);
-
-        // Determine and set the location of the executable
-        setExecutablePath();
-
-        // Determine whether we have an installed or a binary dir run
-        // The latter occurs when simply running from the build directory
-        checkDevBuild();
-
-        // Make sure the directories we write in exist or else make them
-        createDirectories();
-
-        // create a signal handler (only active for linux)
-        // This call is placed as soon as possible, but after the directories are set
-        this->signalHandler_ = new SignalHandler();
-        this->signalHandler_->doCatch(executablePath_g.string(), Core::getLogPathString() + "orxonox_crash.log");
-
-        // Set the correct log path. Before this call, /tmp (Unix) or %TEMP% was used
-        OutputHandler::getOutStream().setLogPath(Core::getLogPathString());
+            setThreadAffinity(static_cast<unsigned int>(limitToCPU));
+#endif
 
         // Manage ini files and set the default settings file (usually orxonox.ini)
@@ -143,16 +279,10 @@
             CommandLine::getValue("settingsFile").getString());
 
+        // Required as well for the config values
         this->languageInstance_ = new Language();
 
         // Do this soon after the ConfigFileManager has been created to open up the
         // possibility to configure everything below here
-        this->setConfigValues();
-
-        // Possible media path override by the command line
-        if (!CommandLine::getArgument("mediaPath")->hasDefaultValue())
-        {
-            //std::string mediaPath = CommandLine::getValue("mediaPath");
-            Core::tsetMediaPath(CommandLine::getValue("mediaPath"));
-        }
+        this->configuration_->initialise();
 
         // Create the lua interface
@@ -168,6 +298,4 @@
         // creates the class hierarchy for all classes with factories
         Factory::createClassHierarchy();
-        
-        this->loaded_ = true;
     }
 
@@ -177,10 +305,9 @@
     Core::~Core()
     {
-        this->loaded_ = false;
-
         delete this->shell_;
         delete this->tclThreadManager_;
         delete this->tclBind_;
         delete this->luaBind_;
+        delete this->configuration_;
         delete this->languageInstance_;
         delete this->configFileManager_;
@@ -190,91 +317,29 @@
         // Also delete external console command that don't belong to an Identifier
         CommandExecutor::destroyExternalCommands();
-
-        assert(Core::singletonRef_s);
-        Core::singletonRef_s = 0;
+        // Clean up class hierarchy stuff (identifiers, XMLPort, configValues, consoleCommand)
+        Identifier::destroyAllIdentifiers();
+
         delete this->signalHandler_;
-    }
-
-    /**
-        @brief Function to collect the SetConfigValue-macro calls.
-    */
-    void Core::setConfigValues()
-    {
-#ifdef NDEBUG
-        const unsigned int defaultLevelConsole = 1;
-        const unsigned int defaultLevelLogfile = 3;
-        const unsigned int defaultLevelShell   = 1;
-#else
-        const unsigned int defaultLevelConsole = 3;
-        const unsigned int defaultLevelLogfile = 4;
-        const unsigned int defaultLevelShell   = 3;
-#endif
-        SetConfigValue(softDebugLevelConsole_, defaultLevelConsole)
-            .description("The maximal level of debug output shown in the console").callback(this, &Core::debugLevelChanged);
-        SetConfigValue(softDebugLevelLogfile_, defaultLevelLogfile)
-            .description("The maximal level of debug output shown in the logfile").callback(this, &Core::debugLevelChanged);
-        SetConfigValue(softDebugLevelShell_, defaultLevelShell)
-            .description("The maximal level of debug output shown in the ingame shell").callback(this, &Core::debugLevelChanged);
-
-        SetConfigValue(language_, Language::getLanguage().defaultLanguage_).description("The language of the ingame text").callback(this, &Core::languageChanged);
-        SetConfigValue(bInitializeRandomNumberGenerator_, true).description("If true, all random actions are different each time you start the game").callback(this, &Core::initializeRandomNumberGenerator);
-
-        SetConfigValue(mediaPathString_, mediaPath_g.string())
-            .description("Relative path to the game data.").callback(this, &Core::mediaPathChanged);
-    }
-
-    /**
-        @brief Callback function if the debug level has changed.
-    */
-    void Core::debugLevelChanged()
-    {
-        // softDebugLevel_ is the maximum of the 3 variables
-        this->softDebugLevel_ = this->softDebugLevelConsole_;
-        if (this->softDebugLevelLogfile_ > this->softDebugLevel_)
-            this->softDebugLevel_ = this->softDebugLevelLogfile_;
-        if (this->softDebugLevelShell_ > this->softDebugLevel_)
-            this->softDebugLevel_ = this->softDebugLevelShell_;
-
-        OutputHandler::setSoftDebugLevel(OutputHandler::LD_All,     this->softDebugLevel_);
-        OutputHandler::setSoftDebugLevel(OutputHandler::LD_Console, this->softDebugLevelConsole_);
-        OutputHandler::setSoftDebugLevel(OutputHandler::LD_Logfile, this->softDebugLevelLogfile_);
-        OutputHandler::setSoftDebugLevel(OutputHandler::LD_Shell,   this->softDebugLevelShell_);
-    }
-
-    /**
-        @brief Callback function if the language has changed.
-    */
-    void Core::languageChanged()
-    {
-        // Read the translation file after the language was configured
-        Language::getLanguage().readTranslatedLanguageFile();
-    }
-
-    /**
-    @brief
-        Callback function if the media path has changed.
-    */
-    void Core::mediaPathChanged()
-    {
-        mediaPath_g = boost::filesystem::path(this->mediaPathString_);
-    }
-
-    /**
-        @brief Returns the softDebugLevel for the given device (returns a default-value if the class ist right about to be created).
+
+        // Don't assign singletonRef_s with NULL! Recreation is not supported
+    }
+
+    /**
+        @brief Returns the softDebugLevel for the given device (returns a default-value if the class is right about to be created).
         @param device The device
         @return The softDebugLevel
     */
-    int Core::getSoftDebugLevel(OutputHandler::OutputDevice device)
+    /*static*/ int Core::getSoftDebugLevel(OutputHandler::OutputDevice device)
     {
         switch (device)
         {
         case OutputHandler::LD_All:
-            return Core::getInstance().softDebugLevel_;
+            return Core::getInstance().configuration_->softDebugLevel_;
         case OutputHandler::LD_Console:
-            return Core::getInstance().softDebugLevelConsole_;
+            return Core::getInstance().configuration_->softDebugLevelConsole_;
         case OutputHandler::LD_Logfile:
-            return Core::getInstance().softDebugLevelLogfile_;
+            return Core::getInstance().configuration_->softDebugLevelLogfile_;
         case OutputHandler::LD_Shell:
-            return Core::getInstance().softDebugLevelShell_;
+            return Core::getInstance().configuration_->softDebugLevelShell_;
         default:
             assert(0);
@@ -288,24 +353,24 @@
         @param level The level
     */
-     void Core::setSoftDebugLevel(OutputHandler::OutputDevice device, int level)
-     {
+    /*static*/ void Core::setSoftDebugLevel(OutputHandler::OutputDevice device, int level)
+    {
         if (device == OutputHandler::LD_All)
-            Core::getInstance().softDebugLevel_ = level;
+            Core::getInstance().configuration_->softDebugLevel_ = level;
         else if (device == OutputHandler::LD_Console)
-            Core::getInstance().softDebugLevelConsole_ = level;
+            Core::getInstance().configuration_->softDebugLevelConsole_ = level;
         else if (device == OutputHandler::LD_Logfile)
-            Core::getInstance().softDebugLevelLogfile_ = level;
+            Core::getInstance().configuration_->softDebugLevelLogfile_ = level;
         else if (device == OutputHandler::LD_Shell)
-            Core::getInstance().softDebugLevelShell_ = level;
+            Core::getInstance().configuration_->softDebugLevelShell_ = level;
 
         OutputHandler::setSoftDebugLevel(device, level);
-     }
+    }
 
     /**
         @brief Returns the configured language.
     */
-    const std::string& Core::getLanguage()
-    {
-        return Core::getInstance().language_;
+    /*static*/ const std::string& Core::getLanguage()
+    {
+        return Core::getInstance().configuration_->language_;
     }
 
@@ -313,66 +378,40 @@
         @brief Sets the language in the config-file back to the default.
     */
-    void Core::resetLanguage()
-    {
-        Core::getInstance().resetLanguageIntern();
-    }
-
-    /**
-        @brief Sets the language in the config-file back to the default.
-    */
-    void Core::resetLanguageIntern()
-    {
-        ResetConfigValue(language_);
-    }
-
-    /**
-    @brief
-        Temporary sets the media path
-    @param path
-        The new media path
-    */
-    void Core::_tsetMediaPath(const std::string& path)
-    {
-        ModifyConfigValue(mediaPathString_, tset, path);
+    /*static*/ void Core::resetLanguage()
+    {
+        Core::getInstance().configuration_->resetLanguage();
+    }
+
+    /*static*/ void Core::tsetMediaPath(const std::string& path)
+    {
+        getInstance().configuration_->tsetMediaPath(path);
     }
 
     /*static*/ const boost::filesystem::path& Core::getMediaPath()
     {
-        return mediaPath_g;
+        return getInstance().configuration_->mediaPath_;
     }
     /*static*/ std::string Core::getMediaPathString()
     {
-        return mediaPath_g.string() + '/';
+        return getInstance().configuration_->mediaPath_.string() + '/';
     }
 
     /*static*/ const boost::filesystem::path& Core::getConfigPath()
     {
-        return configPath_g;
+        return getInstance().configuration_->configPath_;
     }
     /*static*/ std::string Core::getConfigPathString()
     {
-        return configPath_g.string() + '/';
+        return getInstance().configuration_->configPath_.string() + '/';
     }
 
     /*static*/ const boost::filesystem::path& Core::getLogPath()
     {
-        return logPath_g;
+        return getInstance().configuration_->logPath_;
     }
     /*static*/ std::string Core::getLogPathString()
     {
-        return logPath_g.string() + '/';
-    }
-
-    void Core::initializeRandomNumberGenerator()
-    {
-        static bool bInitialized = false;
-        if (!bInitialized && this->bInitializeRandomNumberGenerator_)
-        {
-            srand(static_cast<unsigned int>(time(0)));
-            rand();
-            bInitialized = true;
-        }
-    }
-
+        return getInstance().configuration_->logPath_.string() + '/';
+    }
 
     /**
@@ -388,8 +427,9 @@
     void Core::setThreadAffinity(int limitToCPU)
     {
+#ifdef ORXONOX_PLATFORM_WINDOWS
+
         if (limitToCPU <= 0)
             return;
 
-#ifdef ORXONOX_PLATFORM_WINDOWS
         unsigned int coreNr = limitToCPU - 1;
         // Get the current process core mask
@@ -465,7 +505,7 @@
 #endif
 
-        executablePath_g = boost::filesystem::path(buffer);
+        configuration_->executablePath_ = boost::filesystem::path(buffer);
 #ifndef ORXONOX_PLATFORM_APPLE
-        executablePath_g = executablePath_g.branch_path(); // remove executable name
+        configuration_->executablePath_ = configuration_->executablePath_.branch_path(); // remove executable name
 #endif
     }
@@ -481,11 +521,11 @@
     void Core::checkDevBuild()
     {
-        if (boost::filesystem::exists(executablePath_g / "orxonox_dev_build.keep_me"))
+        if (boost::filesystem::exists(configuration_->executablePath_ / "orxonox_dev_build.keep_me"))
         {
             COUT(1) << "Running from the build tree." << std::endl;
             Core::isDevBuild_ = true;
-            mediaPath_g  = ORXONOX_MEDIA_DEV_PATH;
-            configPath_g = ORXONOX_CONFIG_DEV_PATH;
-            logPath_g    = ORXONOX_LOG_DEV_PATH;
+            configuration_->mediaPath_  = ORXONOX_MEDIA_DEV_PATH;
+            configuration_->configPath_ = ORXONOX_CONFIG_DEV_PATH;
+            configuration_->logPath_    = ORXONOX_LOG_DEV_PATH;
         }
         else
@@ -494,18 +534,19 @@
             // Also set the root path
             boost::filesystem::path relativeExecutablePath(ORXONOX_RUNTIME_INSTALL_PATH);
-            rootPath_g = executablePath_g;
-            while (!boost::filesystem::equivalent(rootPath_g / relativeExecutablePath, executablePath_g) && !rootPath_g.empty())
-                rootPath_g = rootPath_g.branch_path();
-            if (rootPath_g.empty())
+            configuration_->rootPath_ = configuration_->executablePath_;
+            while (!boost::filesystem::equivalent(configuration_->rootPath_ / relativeExecutablePath, configuration_->executablePath_)
+                   && !configuration_->rootPath_.empty())
+                configuration_->rootPath_ = configuration_->rootPath_.branch_path();
+            if (configuration_->rootPath_.empty())
                 ThrowException(General, "Could not derive a root directory. Might the binary installation directory contain '..' when taken relative to the installation prefix path?");
 
             // Using paths relative to the install prefix, complete them
-            mediaPath_g  = rootPath_g / ORXONOX_MEDIA_INSTALL_PATH;
-            configPath_g = rootPath_g / ORXONOX_CONFIG_INSTALL_PATH;
-            logPath_g    = rootPath_g / ORXONOX_LOG_INSTALL_PATH;
+            configuration_->mediaPath_  = configuration_->rootPath_ / ORXONOX_MEDIA_INSTALL_PATH;
+            configuration_->configPath_ = configuration_->rootPath_ / ORXONOX_CONFIG_INSTALL_PATH;
+            configuration_->logPath_    = configuration_->rootPath_ / ORXONOX_LOG_INSTALL_PATH;
 #else
             // There is no root path, so don't set it at all
 
-            mediaPath_g  = ORXONOX_MEDIA_INSTALL_PATH;
+            configuration_->mediaPath_  = ORXONOX_MEDIA_INSTALL_PATH;
 
             // Get user directory
@@ -520,6 +561,6 @@
             userDataPath /= ".orxonox";
 
-            configPath_g = userDataPath / ORXONOX_CONFIG_INSTALL_PATH;
-            logPath_g    = userDataPath / ORXONOX_LOG_INSTALL_PATH;
+            configuration_->configPath_ = userDataPath / ORXONOX_CONFIG_INSTALL_PATH;
+            configuration_->logPath_    = userDataPath / ORXONOX_LOG_INSTALL_PATH;
 #endif
         }
@@ -529,6 +570,6 @@
         {
             std::string directory(CommandLine::getValue("writingPathSuffix").getString());
-            configPath_g = configPath_g / directory;
-            logPath_g    = logPath_g    / directory;
+            configuration_->configPath_ = configuration_->configPath_ / directory;
+            configuration_->logPath_    = configuration_->logPath_    / directory;
         }
     }
@@ -544,6 +585,6 @@
     {
         std::vector<std::pair<boost::filesystem::path, std::string> > directories;
-        directories.push_back(std::make_pair(boost::filesystem::path(configPath_g), "config"));
-        directories.push_back(std::make_pair(boost::filesystem::path(logPath_g), "log"));
+        directories.push_back(std::make_pair(boost::filesystem::path(configuration_->configPath_), "config"));
+        directories.push_back(std::make_pair(boost::filesystem::path(configuration_->logPath_), "log"));
 
         for (std::vector<std::pair<boost::filesystem::path, std::string> >::iterator it = directories.begin();
Index: code/trunk/src/core/Core.h
===================================================================
--- code/trunk/src/core/Core.h	(revision 3279)
+++ code/trunk/src/core/Core.h	(revision 3280)
@@ -43,9 +43,10 @@
 
 #include <cassert>
-#include "OrxonoxClass.h"
 #include "util/OutputHandler.h"
 
 namespace orxonox
 {
+    class CoreConfiguration;
+
     /**
     @brief
@@ -55,5 +56,5 @@
         It determines those by the use of platform specific functions.
     */
-    class _CoreExport Core : public OrxonoxClass
+    class _CoreExport Core
     {
         public:
@@ -65,8 +66,7 @@
                 GeneralException
             */
-            Core();
+            Core(int argc, char** argv);
             ~Core();
 
-            void initialise(int argc, char** argv);
             void setConfigValues();
 
@@ -80,6 +80,5 @@
             static void  resetLanguage();
 
-            static void tsetMediaPath(const std::string& path)
-            { assert(singletonRef_s); singletonRef_s->_tsetMediaPath(path); }
+            static void tsetMediaPath(const std::string& path);
             //! Returns the path to the config files as boost::filesystem::path
             static const boost::filesystem::path& getMediaPath();
@@ -103,11 +102,4 @@
             void setThreadAffinity(int limitToCPU);
 
-            void resetLanguageIntern();
-            void initializeRandomNumberGenerator();
-            void debugLevelChanged();
-            void languageChanged();
-            void mediaPathChanged();
-            void _tsetMediaPath(const std::string& path);
-
             // Singletons
             ConfigFileManager*    configFileManager_;
@@ -119,13 +111,6 @@
             TclThreadManager*     tclThreadManager_;
 
-            int softDebugLevel_;                            //!< The debug level
-            int softDebugLevelConsole_;                     //!< The debug level for the console
-            int softDebugLevelLogfile_;                     //!< The debug level for the logfile
-            int softDebugLevelShell_;                       //!< The debug level for the ingame shell
-            std::string language_;                          //!< The language
-            bool bInitializeRandomNumberGenerator_;         //!< If true, srand(time(0)) is called
-            std::string mediaPathString_;                   //!< Path to the data/media file folder as string
             bool isDevBuild_;                               //!< True for builds in the build directory (not installed)
-            bool loaded_;                                   //!< Only true if constructor was interrupted
+            CoreConfiguration*    configuration_;
 
             static Core* singletonRef_s;
Index: code/trunk/src/core/CorePrereqs.h
===================================================================
--- code/trunk/src/core/CorePrereqs.h	(revision 3279)
+++ code/trunk/src/core/CorePrereqs.h	(revision 3280)
@@ -74,5 +74,5 @@
     namespace KeybindMode
     {
-        enum Enum
+        enum Value
         {
             OnPress,
@@ -165,4 +165,5 @@
     // game states
     class Game;
+    struct GameStateConstrParams;
     class GameState;
     struct GameStateTreeNode;
Index: code/trunk/src/core/Executor.cc
===================================================================
--- code/trunk/src/core/Executor.cc	(revision 3279)
+++ code/trunk/src/core/Executor.cc	(revision 3280)
@@ -99,13 +99,13 @@
 
             // assign all given arguments to the multitypes
-            for (unsigned int i = 0; i < min(tokens.size(), (unsigned int)MAX_FUNCTOR_ARGUMENTS); i++)
+            for (unsigned int i = 0; i < std::min(tokens.size(), (unsigned int)MAX_FUNCTOR_ARGUMENTS); i++)
                 param[i] = tokens[i];
 
             // fill the remaining multitypes with default values
-            for (unsigned int i = tokens.size(); i < min(paramCount, (unsigned int)MAX_FUNCTOR_ARGUMENTS); i++)
+            for (unsigned int i = tokens.size(); i < std::min(paramCount, (unsigned int)MAX_FUNCTOR_ARGUMENTS); i++)
                 param[i] = this->defaultValue_[i];
 
             // evaluate the param types through the functor
-            for (unsigned int i = 0; i < min(paramCount, (unsigned int)MAX_FUNCTOR_ARGUMENTS); i++)
+            for (unsigned int i = 0; i < std::min(paramCount, (unsigned int)MAX_FUNCTOR_ARGUMENTS); i++)
                 this->functor_->evaluateParam(i, param[i]);
 
Index: code/trunk/src/core/Executor.h
===================================================================
--- code/trunk/src/core/Executor.h	(revision 3279)
+++ code/trunk/src/core/Executor.h	(revision 3280)
@@ -33,7 +33,10 @@
 #include "CorePrereqs.h"
 
+#include <algorithm>
+#include <string>
+
 #include "util/Debug.h"
 #include "util/Math.h"
-#include "util/String.h"
+#include "util/StringUtils.h"
 #include "util/SubString.h"
 #include "Functor.h"
@@ -101,5 +104,5 @@
             COUT(5) << tokens[i]; \
         } \
-        COUT(5) << ") and " << max((int)paramCount - (int)tokens.size(), 0) << " default values ("; \
+        COUT(5) << ") and " << std::max((int)paramCount - (int)tokens.size(), 0) << " default values ("; \
         for (unsigned int i = tokens.size(); i < paramCount; i++) \
         { \
@@ -175,5 +178,5 @@
             inline bool hasReturnvalue() const
                 { return this->functor_->hasReturnvalue(); }
-            inline FunctionType getType() const
+            inline FunctionType::Value getType() const
                 { return this->functor_->getType(); }
             inline const MultiType& getReturnvalue() const
@@ -201,5 +204,5 @@
                     return this->defaultValue_[index];
 
-                return MT_null;
+                return MT_Type::Null;
             }
 
Index: code/trunk/src/core/Functor.h
===================================================================
--- code/trunk/src/core/Functor.h	(revision 3279)
+++ code/trunk/src/core/Functor.h	(revision 3280)
@@ -35,5 +35,5 @@
 #include "util/Debug.h"
 #include "util/MultiType.h"
-#include "util/String.h"
+#include "util/StringUtils.h"
 
 namespace orxonox
@@ -41,10 +41,13 @@
     const unsigned int MAX_FUNCTOR_ARGUMENTS = 5;
 
-    enum FunctionType
+    namespace FunctionType
     {
-        FT_MEMBER,
-        FT_CONSTMEMBER,
-        FT_STATIC
-    };
+        enum Value
+        {
+            Member,
+            ConstMember,
+            Static
+        };
+    }
 
 
@@ -98,9 +101,9 @@
             virtual ~Functor() {}
 
-            virtual void operator()(const MultiType& param1 = MT_null, const MultiType& param2 = MT_null, const MultiType& param3 = MT_null, const MultiType& param4 = MT_null, const MultiType& param5 = MT_null) = 0;
+            virtual void operator()(const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) = 0;
 
             inline unsigned int getParamCount() const { return this->numParams_; }
             inline bool hasReturnvalue() const { return this->hasReturnValue_; }
-            inline FunctionType getType() const { return this->type_; }
+            inline FunctionType::Value getType() const { return this->type_; }
             inline const MultiType& getReturnvalue() const { return this->returnedValue_; }
 
@@ -113,5 +116,5 @@
             unsigned int numParams_;
             bool hasReturnValue_;
-            FunctionType type_;
+            FunctionType::Value type_;
             MultiType returnedValue_;
 
@@ -124,5 +127,5 @@
         public:
             virtual ~FunctorStatic() {}
-            virtual void operator()(const MultiType& param1 = MT_null, const MultiType& param2 = MT_null, const MultiType& param3 = MT_null, const MultiType& param4 = MT_null, const MultiType& param5 = MT_null) = 0;
+            virtual void operator()(const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) = 0;
     };
 
@@ -139,8 +142,8 @@
             virtual ~FunctorMember() {}
 
-            virtual void operator()(T* object, const MultiType& param1 = MT_null, const MultiType& param2 = MT_null, const MultiType& param3 = MT_null, const MultiType& param4 = MT_null, const MultiType& param5 = MT_null) = 0;
-            virtual void operator()(const T* object, const MultiType& param1 = MT_null, const MultiType& param2 = MT_null, const MultiType& param3 = MT_null, const MultiType& param4 = MT_null, const MultiType& param5 = MT_null) = 0;
-
-            virtual void operator()(const MultiType& param1 = MT_null, const MultiType& param2 = MT_null, const MultiType& param3 = MT_null, const MultiType& param4 = MT_null, const MultiType& param5 = MT_null)
+            virtual void operator()(T* object, const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) = 0;
+            virtual void operator()(const T* object, const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) = 0;
+
+            virtual void operator()(const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null)
             {
                 if (this->bConstObject_)
@@ -322,5 +325,5 @@
                 this->numParams_ = numparams; \
                 this->hasReturnValue_ = returnvalue; \
-                this->type_ = FT_STATIC; \
+                this->type_ = FunctionType::Static; \
                 this->functionPointer_ = functionPointer; \
                 \
@@ -329,5 +332,5 @@
             } \
     \
-            void operator()(const MultiType& param1 = MT_null, const MultiType& param2 = MT_null, const MultiType& param3 = MT_null, const MultiType& param4 = MT_null, const MultiType& param5 = MT_null) \
+            void operator()(const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) \
             { \
                 FUNCTOR_STORE_RETURNVALUE(returnvalue, (*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \
@@ -363,14 +366,14 @@
                 this->numParams_ = numparams; \
                 this->hasReturnValue_ = returnvalue; \
-                this->type_ = FT_MEMBER; \
+                this->type_ = FunctionType::Member; \
                 this->functionPointer_ = functionPointer; \
             } \
     \
-            void operator()(T* object, const MultiType& param1 = MT_null, const MultiType& param2 = MT_null, const MultiType& param3 = MT_null, const MultiType& param4 = MT_null, const MultiType& param5 = MT_null) \
+            void operator()(T* object, const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) \
             { \
                 FUNCTOR_STORE_RETURNVALUE(returnvalue, (*object.*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \
             } \
     \
-            void operator()(const T* object, const MultiType& param1 = MT_null, const MultiType& param2 = MT_null, const MultiType& param3 = MT_null, const MultiType& param4 = MT_null, const MultiType& param5 = MT_null) \
+            void operator()(const T* object, const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) \
             { \
                 COUT(1) << "An error occurred in Functor.h:" << std::endl; \
@@ -396,14 +399,14 @@
                 this->numParams_ = numparams; \
                 this->hasReturnValue_ = returnvalue; \
-                this->type_ = FT_CONSTMEMBER; \
+                this->type_ = FunctionType::ConstMember; \
                 this->functionPointer_ = functionPointer; \
             } \
     \
-            void operator()(T* object, const MultiType& param1 = MT_null, const MultiType& param2 = MT_null, const MultiType& param3 = MT_null, const MultiType& param4 = MT_null, const MultiType& param5 = MT_null) \
+            void operator()(T* object, const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) \
             { \
                 FUNCTOR_STORE_RETURNVALUE(returnvalue, (*object.*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \
             } \
     \
-            void operator()(const T* object, const MultiType& param1 = MT_null, const MultiType& param2 = MT_null, const MultiType& param3 = MT_null, const MultiType& param4 = MT_null, const MultiType& param5 = MT_null) \
+            void operator()(const T* object, const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) \
             { \
                 FUNCTOR_STORE_RETURNVALUE(returnvalue, (*object.*this->functionPointer_)(FUNCTOR_FUNCTION_CALL(numparams))); \
Index: code/trunk/src/core/Game.cc
===================================================================
--- code/trunk/src/core/Game.cc	(revision 3279)
+++ code/trunk/src/core/Game.cc	(revision 3280)
@@ -58,5 +58,13 @@
     SetConsoleCommandShortcutExternAlias(stop_game, "exit");
 
-    struct _CoreExport GameStateTreeNode
+    std::map<std::string, Game::GameStateInfo> Game::gameStateDeclarations_s;
+    Game* Game::singletonRef_s = 0;
+
+
+    /**
+    @brief
+        Represents one node of the game state tree.
+    */
+    struct GameStateTreeNode
     {
         GameState* state_;
@@ -65,6 +73,32 @@
     };
 
-    std::map<std::string, GameState*> Game::allStates_s;
-    Game* Game::singletonRef_s = 0;
+
+    /**
+    @brief
+        Another helper class for the Game singleton: we cannot derive
+        Game from OrxonoxClass because we need to handle the Identifier
+        destruction in the Core destructor.
+    */
+    class GameConfiguration : public OrxonoxClass
+    {
+    public:
+        GameConfiguration()
+        {
+            RegisterRootObject(GameConfiguration);
+            this->setConfigValues();
+        }
+
+        void setConfigValues()
+        {
+            SetConfigValue(statisticsRefreshCycle_, 250000)
+                .description("Sets the time in microseconds interval at which average fps, etc. get updated.");
+            SetConfigValue(statisticsAvgLength_, 1000000)
+                .description("Sets the time in microseconds interval at which average fps, etc. gets calculated.");
+        }
+
+        unsigned int statisticsRefreshCycle_;
+        unsigned int statisticsAvgLength_;
+    };
+
 
     /**
@@ -74,8 +108,16 @@
     Game::Game(int argc, char** argv)
     {
-        assert(singletonRef_s == 0);
+        if (singletonRef_s != 0)
+        {
+            COUT(0) << "Error: The Game singleton cannot be recreated! Shutting down." << std::endl;
+            abort();
+        }
         singletonRef_s = this;
 
-        this->abort_ = false;
+        this->bAbort_ = false;
+        bChangingState_ = false;
+
+        // Create an empty root state
+        declareGameState<GameState>("GameState", "emptyRootGameState", true, false);
 
         // reset statistics
@@ -87,13 +129,28 @@
         this->avgTickTime_ = 0.0f;
 
-
         // Set up a basic clock to keep time
         this->gameClock_ = new Clock();
 
-        this->core_ = new orxonox::Core();
-        this->core_->initialise(argc, argv);
-
-        RegisterRootObject(Game);
-        this->setConfigValues();
+        // Create the Core
+        this->core_ = new Core(argc, argv);
+
+        // After the core has been created, we can safely instantiate the GameStates
+        for (std::map<std::string, GameStateInfo>::const_iterator it = gameStateDeclarations_s.begin();
+            it != gameStateDeclarations_s.end(); ++it)
+        {
+            // Only create the states appropriate for the game mode
+            //if (GameMode::showsGraphics || !it->second.bGraphicsMode)
+            GameStateConstrParams params = { it->second.stateName, it->second.bIgnoreTickTime };
+            gameStates_[getLowercase(it->second.stateName)] = GameStateFactory::fabricate(it->second.className, params);
+        }
+
+        // The empty root state is ALWAYS loaded!
+        this->rootStateNode_ = shared_ptr<GameStateTreeNode>(new GameStateTreeNode());
+        this->rootStateNode_->state_ = getState("emptyRootGameState");
+        this->activeStateNode_ = this->rootStateNode_;
+        this->activeStates_.push_back(this->rootStateNode_->state_);
+
+        // Do this after the Core creation!
+        this->configuration_ = new GameConfiguration();
     }
 
@@ -103,36 +160,20 @@
     Game::~Game()
     {
-        // Destroy pretty much everyhting left
+        // Destroy the configuration helper class instance
+        delete this->configuration_;
+
+        // Destroy the GameStates (note that the nodes still point to them, but doesn't matter)
+        for (std::map<std::string, GameState*>::const_iterator it = gameStates_.begin();
+            it != gameStates_.end(); ++it)
+            delete it->second;
+
+        // Destroy the Core and with it almost everything
         delete this->core_;
-
         delete this->gameClock_;
 
-        assert(singletonRef_s);
-        singletonRef_s = 0;
-    }
-
-    void Game::setConfigValues()
-    {
-        SetConfigValue(statisticsRefreshCycle_, 250000)
-            .description("Sets the time in microseconds interval at which average fps, etc. get updated.");
-        SetConfigValue(statisticsAvgLength_, 1000000)
-            .description("Sets the time in microseconds interval at which average fps, etc. gets calculated.");
-        SetConfigValue(levelName_, "presentation_dm.oxw")
-            .description("Sets the preselection of the level in the main menu.");
-    }
-
-    void Game::setLevel(std::string levelName)
-    {
-        ModifyConfigValue(levelName_, set, levelName);
-    }
-
-    std::string Game::getLevel()
-    {
-        std::string levelName;
-        CommandLine::getValue("level", &levelName);
-        if (levelName == "")
-            return levelName_;
-        else
-            return levelName;
+        // Take care of the GameStateFactories
+        GameStateFactory::destroyFactories();
+
+        // Don't assign singletonRef_s with NULL! Recreation is not supported
     }
 
@@ -147,12 +188,10 @@
     void Game::run()
     {
-        // Always start with the ROOT state
-        this->requestedStateNodes_.push_back(this->rootStateNode_);
-        this->activeStateNode_ = this->rootStateNode_;
-        this->loadState(this->rootStateNode_->state_);
+        if (this->requestedStateNodes_.empty())
+            COUT(0) << "Warning: Starting game without requesting GameState. This automatically terminates the program." << std::endl;
 
         // START GAME
         this->gameClock_->capture(); // first delta time should be about 0 seconds
-        while (!this->abort_ && !this->activeStates_.empty())
+        while (!this->bAbort_ && (!this->activeStates_.empty() || this->requestedStateNodes_.size() > 0))
         {
             this->gameClock_->capture();
@@ -160,48 +199,97 @@
 
             // STATISTICS
-            statisticsTickInfo tickInfo = {currentTime, 0};
+            StatisticsTickInfo tickInfo = {currentTime, 0};
             statisticsTickTimes_.push_back(tickInfo);
             this->periodTime_ += this->gameClock_->getDeltaTimeMicroseconds();
 
             // UPDATE STATE STACK
-            while (this->requestedStateNodes_.size() > 1)
-            {
-                // Note: this->requestedStateNodes_.front() is the currently active state node
-                std::vector<shared_ptr<GameStateTreeNode> >::iterator it = this->requestedStateNodes_.begin() + 1;
-                if (*it == this->activeStateNode_->parent_.lock())
+            while (this->requestedStateNodes_.size() > 0)
+            {
+                shared_ptr<GameStateTreeNode> requestedStateNode = this->requestedStateNodes_.front();
+                assert(this->activeStateNode_);
+                if (!this->activeStateNode_->parent_.expired() && requestedStateNode == this->activeStateNode_->parent_.lock())
                     this->unloadState(this->activeStateNode_->state_);
                 else // has to be child
-                    this->loadState((*it)->state_);
-                this->activeStateNode_ = *it;
+                {
+                    try
+                    {
+                        this->loadState(requestedStateNode->state_);
+                    }
+                    catch (const std::exception& ex)
+                    {
+                        COUT(1) << "Error: Loading GameState '" << requestedStateNode->state_->getName() << "' failed: " << ex.what() << std::endl;
+                        // All scheduled operations have now been rendered inert --> flush them and issue a warning
+                        if (this->requestedStateNodes_.size() > 1)
+                            COUT(1) << "All " << this->requestedStateNodes_.size() - 1 << " scheduled transitions have been ignored." << std::endl;
+                        this->requestedStateNodes_.clear();
+                        break;
+                    }
+                }
+                this->activeStateNode_ = requestedStateNode;
                 this->requestedStateNodes_.erase(this->requestedStateNodes_.begin());
             }
 
-            // UPDATE, bottom to top in the stack
-            this->core_->update(*this->gameClock_);
-            for (std::vector<GameState*>::const_iterator it = this->activeStates_.begin();
+            // UPDATE, Core first
+            try
+            {
+                this->core_->update(*this->gameClock_);
+            }
+            catch (...)
+            {
+                COUT(0) << "An exception occured while ticking the Core. This should really never happen!" << std::endl;
+                COUT(0) << "Closing the program." << std::endl;
+                this->stop();
+                break;
+            }
+
+            // UPDATE, GameStates bottom to top in the stack
+            // Note: The first element is the empty root state, which doesn't need ticking
+            for (std::vector<GameState*>::const_iterator it = this->activeStates_.begin() + 1;
                 it != this->activeStates_.end(); ++it)
             {
-                // Add tick time for most of the states
-                uint64_t timeBeforeTick;
-                if ((*it)->getCountTickTime())
-                    timeBeforeTick = this->gameClock_->getRealMicroseconds();
-                
-                (*it)->update(*this->gameClock_);
-
-                if ((*it)->getCountTickTime())
-                    this->addTickTime(static_cast<uint32_t>(this->gameClock_->getRealMicroseconds() - timeBeforeTick));
+                bool threwException = false;
+                try
+                {
+                    // Add tick time for most of the states
+                    uint64_t timeBeforeTick;
+                    if (!(*it)->ignoreTickTime())
+                        timeBeforeTick = this->gameClock_->getRealMicroseconds();
+                    (*it)->update(*this->gameClock_);
+                    if (!(*it)->ignoreTickTime())
+                        this->addTickTime(static_cast<uint32_t>(this->gameClock_->getRealMicroseconds() - timeBeforeTick));
+                }
+                catch (const std::exception& ex)
+                {
+                    threwException = true;
+                    COUT(0) << "Exception while ticking: " << ex.what() << std::endl;
+                }
+                catch (...)
+                {
+                    threwException = true;
+                }
+                if (threwException)
+                {
+                    COUT(1) << "An exception occured while ticking GameState '" << (*it)->getName() << "'. This should really never happen!" << std::endl;
+                    COUT(1) << "Unloading all GameStates depending on the one that crashed." << std::endl;
+                    if ((*it)->getParent() != NULL)
+                        this->requestState((*it)->getParent()->getName());
+                    else
+                        this->stop();
+                    break;
+                }
+
             }
 
             // STATISTICS
-            if (this->periodTime_ > statisticsRefreshCycle_)
-            {
-                std::list<statisticsTickInfo>::iterator it = this->statisticsTickTimes_.begin();
+            if (this->periodTime_ > this->configuration_->statisticsRefreshCycle_)
+            {
+                std::list<StatisticsTickInfo>::iterator it = this->statisticsTickTimes_.begin();
                 assert(it != this->statisticsTickTimes_.end());
-                int64_t lastTime = currentTime - this->statisticsAvgLength_;
+                int64_t lastTime = currentTime - this->configuration_->statisticsAvgLength_;
                 if ((int64_t)it->tickTime < lastTime)
                 {
                     do
                     {
-                        assert(this->periodTickTime_ > it->tickLength);
+                        assert(this->periodTickTime_ >= it->tickLength);
                         this->periodTickTime_ -= it->tickLength;
                         ++it;
@@ -215,12 +303,12 @@
                 this->avgTickTime_ = static_cast<float>(this->periodTickTime_) / framesPerPeriod / 1000.0f;
 
-                this->periodTime_ -= this->statisticsRefreshCycle_;
+                this->periodTime_ -= this->configuration_->statisticsRefreshCycle_;
             }
         }
 
         // UNLOAD all remaining states
-        while (!this->activeStates_.empty())
+        while (this->activeStates_.size() > 1)
             this->unloadState(this->activeStates_.back());
-        this->activeStateNode_.reset();
+        this->activeStateNode_ = this->rootStateNode_;
         this->requestedStateNodes_.clear();
     }
@@ -228,5 +316,5 @@
     void Game::stop()
     {
-        this->abort_ = true;
+        this->bAbort_ = true;
     }
 
@@ -244,13 +332,18 @@
     {
         GameState* state = this->getState(name);
-        if (state == NULL || this->activeStateNode_ == NULL)
+        if (state == NULL)
             return;
 
-        shared_ptr<GameStateTreeNode> requestedNode;
-
-        // this->requestedStateNodes_.back() is the currently active state
-        shared_ptr<GameStateTreeNode> lastRequestedNode = this->requestedStateNodes_.back();
-
-        // Already the active node?
+        //if (this->bChangingState_)
+        //{
+        //    COUT(2) << "Warning: Requesting GameStates while loading/unloading a GameState is illegal! Ignoring." << std::endl;
+        //    return;
+        //}
+
+        shared_ptr<GameStateTreeNode> lastRequestedNode;
+        if (this->requestedStateNodes_.empty())
+            lastRequestedNode = this->activeStateNode_;
+        else
+            lastRequestedNode = this->requestedStateNodes_.back();
         if (state == lastRequestedNode->state_)
         {
@@ -260,26 +353,31 @@
 
         // Check children first
+        std::vector<shared_ptr<GameStateTreeNode> > requestedNodes;
         for (unsigned int i = 0; i < lastRequestedNode->children_.size(); ++i)
         {
             if (lastRequestedNode->children_[i]->state_ == state)
             {
-                requestedNode = lastRequestedNode->children_[i];
+                requestedNodes.push_back(lastRequestedNode->children_[i]);
                 break;
             }
         }
 
-        // Check parent and all its grand parents
-        shared_ptr<GameStateTreeNode> currentNode = lastRequestedNode;
-        while (requestedNode == NULL && currentNode != NULL)
-        {
-            if (currentNode->state_ == state)
-                requestedNode = currentNode;
-            currentNode = currentNode->parent_.lock();
-        }
-
-        if (requestedNode == NULL)
+        if (requestedNodes.empty())
+        {
+            // Check parent and all its grand parents
+            shared_ptr<GameStateTreeNode> currentNode = lastRequestedNode;
+            while (currentNode != NULL)
+            {
+                if (currentNode->state_ == state)
+                    break;
+                currentNode = currentNode->parent_.lock();
+                requestedNodes.push_back(currentNode);
+            }
+        }
+
+        if (requestedNodes.empty())
             COUT(1) << "Error: Requested GameState transition is not allowed. Ignoring." << std::endl;
         else
-            this->requestedStateNodes_.push_back(requestedNode);
+            this->requestedStateNodes_.insert(requestedStateNodes_.end(), requestedNodes.begin(), requestedNodes.end());
     }
 
@@ -293,14 +391,19 @@
     void Game::popState()
     {
-        if (this->activeStateNode_ != NULL && this->requestedStateNodes_.back()->parent_.lock())
-            this->requestState(this->requestedStateNodes_.back()->parent_.lock()->state_->getName());
+        shared_ptr<GameStateTreeNode> lastRequestedNode;
+        if (this->requestedStateNodes_.empty())
+            lastRequestedNode = this->activeStateNode_;
         else
-            COUT(2) << "Warning: Could not pop GameState. Ignoring." << std::endl;
+            lastRequestedNode = this->requestedStateNodes_.back();
+        if (lastRequestedNode != this->rootStateNode_)
+            this->requestState(lastRequestedNode->parent_.lock()->state_->getName());
+        else
+            COUT(2) << "Warning: Can't pop the internal dummy root GameState" << std::endl;
     }
 
     GameState* Game::getState(const std::string& name)
     {
-        std::map<std::string, GameState*>::const_iterator it = allStates_s.find(getLowercase(name));
-        if (it != allStates_s.end())
+        std::map<std::string, GameState*>::const_iterator it = gameStates_.find(getLowercase(name));
+        if (it != gameStates_.end())
             return it->second;
         else
@@ -325,58 +428,37 @@
             while(pos < str.size() && str[pos] != ' ')
                 ++pos;
-            stateStrings.push_back(std::pair<std::string, unsigned>(
-                str.substr(startPos, pos - startPos), indentation));
+            stateStrings.push_back(std::make_pair(str.substr(startPos, pos - startPos), indentation));
         }
         unsigned int currentLevel = 0;
-        shared_ptr<GameStateTreeNode> currentNode;
+        shared_ptr<GameStateTreeNode> currentNode = this->rootStateNode_;
         for (std::vector<std::pair<std::string, unsigned> >::const_iterator it = stateStrings.begin(); it != stateStrings.end(); ++it)
         {
             std::string newStateName = it->first;
-            unsigned newLevel = it->second;
+            unsigned newLevel = it->second + 1; // empty root is 0
             GameState* newState = this->getState(newStateName);
             if (!newState)
-                ThrowException(GameState, std::string("GameState with name '") + newStateName + "' not found!");
-            if (newLevel == 0)
-            {
-                // root
-                if (this->rootStateNode_ != NULL)
-                    ThrowException(GameState, "No two root GameStates are allowed!");
-                shared_ptr<GameStateTreeNode> newNode(new GameStateTreeNode);
-                newNode->state_ = newState;
-                this->rootStateNode_ = newNode;
-                currentNode = this->rootStateNode_;
-            }
-            else if (currentNode)
-            {
-                shared_ptr<GameStateTreeNode> newNode(new GameStateTreeNode);
-                newNode->state_ = newState;
-                if (newLevel < currentLevel)
-                {
-                    // Get down the hierarchy
-                    do
-                        currentNode = currentNode->parent_.lock();
-                    while (newLevel < --currentLevel);
-                }
-                if (newLevel == currentLevel)
-                {
-                    // same level
-                    newNode->parent_ = currentNode->parent_;
-                    newNode->parent_.lock()->children_.push_back(newNode);
-                }
-                else if (newLevel == currentLevel + 1)
-                {
-                    // child
-                    newNode->parent_ = currentNode;
-                    currentNode->children_.push_back(newNode);
-                }
-                else
-                    ThrowException(GameState, "Indentation error while parsing the hierarchy.");
-                currentNode = newNode;
-                currentLevel = newLevel;
+                ThrowException(GameState, "GameState with name '" << newStateName << "' not found!");
+            if (newState == this->rootStateNode_->state_)
+                ThrowException(GameState, "You shouldn't use 'emptyRootGameState' in the hierarchy...");
+            shared_ptr<GameStateTreeNode> newNode(new GameStateTreeNode);
+            newNode->state_ = newState;
+
+            if (newLevel <= currentLevel)
+            {
+                do
+                    currentNode = currentNode->parent_.lock();
+                while (newLevel <= --currentLevel);
+            }
+            if (newLevel == currentLevel + 1)
+            {
+                // Add the child
+                newNode->parent_ = currentNode;
+                currentNode->children_.push_back(newNode);
+                currentNode->state_->addChild(newNode->state_);
             }
             else
-            {
-                ThrowException(GameState, "No root GameState specified!");
-            }
+                ThrowException(GameState, "Indentation error while parsing the hierarchy.");
+            currentNode = newNode;
+            currentLevel = newLevel;
         }
     }
@@ -386,38 +468,46 @@
     void Game::loadState(GameState* state)
     {
+        this->bChangingState_ = true;
+        state->activate();
         if (!this->activeStates_.empty())
             this->activeStates_.back()->activity_.topState = false;
-        state->activate();
+        this->activeStates_.push_back(state);
         state->activity_.topState = true;
-        this->activeStates_.push_back(state);
+        this->bChangingState_ = false;
     }
 
     void Game::unloadState(orxonox::GameState* state)
     {
+        this->bChangingState_ = true;
         state->activity_.topState = false;
-        state->deactivate();
         this->activeStates_.pop_back();
         if (!this->activeStates_.empty())
             this->activeStates_.back()->activity_.topState = true;
-    }
-
-    /*static*/ bool Game::addGameState(GameState* state)
-    {
-        std::map<std::string, GameState*>::const_iterator it = allStates_s.find(getLowercase(state->getName()));
-        if (it == allStates_s.end())
-            allStates_s[getLowercase(state->getName())] = state;
-        else
-            ThrowException(GameState, "Cannot add two GameStates with the same name to 'Game'.");
-
-        // just a required dummy return value
-        return true;
-    }
-
-    /*static*/ void Game::destroyStates()
-    {
-        // Delete all GameStates created by the macros
-        for (std::map<std::string, GameState*>::const_iterator it = allStates_s.begin(); it != allStates_s.end(); ++it)
+        try
+        {
+            state->deactivate();
+        }
+        catch (const std::exception& ex)
+        {
+            COUT(2) << "Warning: Unloading GameState '" << state->getName() << "' threw an exception: " << ex.what() << std::endl;
+            COUT(2) << "         There might be potential resource leaks involved! To avoid this, improve exception-safety." << std::endl;
+        }
+        this->bChangingState_ = false;
+    }
+
+    std::map<std::string, Game::GameStateFactory*> Game::GameStateFactory::factories_s;
+
+    /*static*/ GameState* Game::GameStateFactory::fabricate(const std::string& className, const GameStateConstrParams& params)
+    {
+        std::map<std::string, GameStateFactory*>::const_iterator it = factories_s.find(className);
+        assert(it != factories_s.end());
+        return it->second->fabricate(params);
+    }
+
+    /*static*/ void Game::GameStateFactory::destroyFactories()
+    {
+        for (std::map<std::string, GameStateFactory*>::const_iterator it = factories_s.begin(); it != factories_s.end(); ++it)
             delete it->second;
-        allStates_s.clear();
+        factories_s.clear();
     }
 }
Index: code/trunk/src/core/Game.h
===================================================================
--- code/trunk/src/core/Game.h	(revision 3279)
+++ code/trunk/src/core/Game.h	(revision 3280)
@@ -46,5 +46,6 @@
 #include <boost/preprocessor/cat.hpp>
 
-#include "OrxonoxClass.h"
+#include "util/Debug.h"
+#include "util/StringUtils.h"
 
 /**
@@ -53,10 +54,11 @@
     and every following paramter is a constructor argument (which is usually non existent)
 */
-#define AddGameState(classname, ...) \
-    static bool BOOST_PP_CAT(bGameStateDummy_##classname, __LINE__) = orxonox::Game::addGameState(new classname(__VA_ARGS__))
+#define DeclareGameState(className, stateName, bIgnoreTickTime, bGraphicsMode) \
+    static bool BOOST_PP_CAT(bGameStateDummy_##className, __LINE__) = orxonox::Game::declareGameState<className>(#className, stateName, bIgnoreTickTime, bGraphicsMode)
 
-// tolua_begin
 namespace orxonox
 {
+    class GameConfiguration;
+
     /**
     @brief
@@ -64,13 +66,8 @@
     */
     class _CoreExport Game
-    // tolua_end
-        : public OrxonoxClass
-    // tolua_begin
     {
-    //tolua_end
     public:
         Game(int argc, char** argv);
         ~Game();
-        void setConfigValues();
 
         void setStateHierarchy(const std::string& str);
@@ -91,13 +88,39 @@
         void addTickTime(uint32_t length);
 
-        static bool addGameState(GameState* state);
-        static void destroyStates();
-        static Game& getInstance() { assert(singletonRef_s); return *singletonRef_s; } //tolua_export
-
-        void setLevel(std::string levelName); //tolua_export
-        std::string getLevel(); //tolua_export
+        template <class T>
+        static bool declareGameState(const std::string& className, const std::string& stateName, bool bIgnoreTickTime, bool bConsoleMode);
+        static Game& getInstance() { assert(singletonRef_s); return *singletonRef_s; }
 
     private:
-        struct statisticsTickInfo
+        class _CoreExport GameStateFactory
+        {
+        public:
+            virtual ~GameStateFactory() { }
+            static GameState* fabricate(const std::string& className, const GameStateConstrParams& params);
+            template <class T>
+            static void createFactory(const std::string& className)
+                { factories_s[className] = new TemplateGameStateFactory<T>(); }
+            static void destroyFactories();
+        private:
+            virtual GameState* fabricate(const GameStateConstrParams& params) = 0;
+            static std::map<std::string, GameStateFactory*> factories_s;
+        };
+        template <class T>
+        class TemplateGameStateFactory : public GameStateFactory
+        {
+        public:
+            GameState* fabricate(const GameStateConstrParams& params)
+                { return new T(params); }
+        };
+
+        struct GameStateInfo
+        {
+            std::string stateName;
+            std::string className;
+            bool bIgnoreTickTime;
+            bool bGraphicsMode;
+        };
+
+        struct StatisticsTickInfo
         {
             uint64_t    tickTime;
@@ -110,5 +133,6 @@
         void unloadState(GameState* state);
 
-        std::vector<GameState*>         activeStates_;
+        std::map<std::string, GameState*>    gameStates_;
+        std::vector<GameState*>              activeStates_;
         boost::shared_ptr<GameStateTreeNode> rootStateNode_;
         boost::shared_ptr<GameStateTreeNode> activeStateNode_;
@@ -117,10 +141,12 @@
         Core*                           core_;
         Clock*                          gameClock_;
+        GameConfiguration*              configuration_;
 
-        bool                            abort_;
+        bool                            bChangingState_;
+        bool                            bAbort_;
 
         // variables for time statistics
         uint64_t                        statisticsStartTime_;
-        std::list<statisticsTickInfo>   statisticsTickTimes_;
+        std::list<StatisticsTickInfo>   statisticsTickTimes_;
         uint32_t                        periodTime_;
         uint32_t                        periodTickTime_;
@@ -128,14 +154,33 @@
         float                           avgTickTime_;
 
-        // config values
-        unsigned int                    statisticsRefreshCycle_;
-        unsigned int                    statisticsAvgLength_;
-        std::string                     levelName_;
+        static std::map<std::string, GameStateInfo> gameStateDeclarations_s;
+        static Game* singletonRef_s;        //!< Pointer to the Singleton
+    };
 
-        static std::map<std::string, GameState*> allStates_s;
-        static Game* singletonRef_s;        //!< Pointer to the Singleton
-        // tolua_begin
-    };
+    template <class T>
+    /*static*/ bool Game::declareGameState(const std::string& className, const std::string& stateName, bool bIgnoreTickTime, bool bGraphicsMode)
+    {
+        std::map<std::string, GameStateInfo>::const_iterator it = gameStateDeclarations_s.find(getLowercase(stateName));
+        if (it == gameStateDeclarations_s.end())
+        {
+            GameStateInfo& info = gameStateDeclarations_s[getLowercase(stateName)];
+            info.stateName = stateName;
+            info.className = className;
+            info.bIgnoreTickTime = bIgnoreTickTime;
+            info.bGraphicsMode = bGraphicsMode;
+        }
+        else
+        {
+            COUT(0) << "Error: Cannot declare two GameStates with the same name." << std::endl;
+            COUT(0) << "       Ignoring second one ('" << stateName << "')." << std::endl;
+        }
+
+        // Create a factory to delay GameState creation
+        GameStateFactory::createFactory<T>(className);
+
+        // just a required dummy return value
+        return true;
+    }
 }
-//tolua_end
+
 #endif /* _Game_H__ */
Index: code/trunk/src/core/GameState.cc
===================================================================
--- code/trunk/src/core/GameState.cc	(revision 3279)
+++ code/trunk/src/core/GameState.cc	(revision 3280)
@@ -45,7 +45,7 @@
         Constructor only initialises variables and sets the name permanently.
     */
-    GameState::GameState(const std::string& name, bool countTickTime)
-        : name_(name)
-        , bCountTickTime_(countTickTime)
+    GameState::GameState(const GameStateConstrParams& params)
+        : name_(params.name)
+        , bIgnoreTickTime_(params.bIgnoreTickTime)
         , parent_(0)
     {
Index: code/trunk/src/core/GameState.h
===================================================================
--- code/trunk/src/core/GameState.h	(revision 3279)
+++ code/trunk/src/core/GameState.h	(revision 3280)
@@ -45,4 +45,14 @@
     /**
     @brief
+        Helper class to group construction parameters for better genericity.
+    */
+    struct GameStateConstrParams
+    {
+        std::string name;
+        bool bIgnoreTickTime;
+    };
+
+    /**
+    @brief
         An implementation of a tree to manage game states.
         This leads to a certain hierarchy that is created at runtime.
@@ -77,5 +87,5 @@
 
     public:
-        GameState(const std::string& name, bool countTicktime = true);
+        GameState(const GameStateConstrParams& params);
         virtual ~GameState();
 
@@ -84,5 +94,5 @@
         GameState* getParent()       const { return this->parent_; }
 
-        bool getCountTickTime()      const { return this->bCountTickTime_; }
+        bool ignoreTickTime()        const { return this->bIgnoreTickTime_; }
 
         void addChild(GameState* state);
@@ -90,7 +100,7 @@
 
     protected:
-        virtual void activate() = 0;
-        virtual void deactivate() = 0;
-        virtual void update(const Clock& time) = 0;
+        virtual void activate() { }
+        virtual void deactivate() { }
+        virtual void update(const Clock& time) { }
 
     private:
@@ -103,5 +113,5 @@
         const std::string                        name_;
         State                                    activity_;
-        const bool                               bCountTickTime_;
+        const bool                               bIgnoreTickTime_;
         GameState*                               parent_;
         std::map<std::string, GameState*>        children_;
Index: code/trunk/src/core/IRC.cc
===================================================================
--- code/trunk/src/core/IRC.cc	(revision 3279)
+++ code/trunk/src/core/IRC.cc	(revision 3280)
@@ -68,5 +68,5 @@
         {   COUT(1) << "Error while initializing Tcl (IRC): " << e.what();   }
 
-        this->nickname_ = "orx" + getConvertedValue<int, std::string>((unsigned int)rand());
+        this->nickname_ = "orx" + multi_cast<std::string>(static_cast<unsigned int>(rand()));
         TclThreadManager::execute(threadID, "set nickname " + this->nickname_);
         TclThreadManager::execute(threadID, "source irc.tcl");
Index: code/trunk/src/core/Identifier.cc
===================================================================
--- code/trunk/src/core/Identifier.cc	(revision 3279)
+++ code/trunk/src/core/Identifier.cc	(revision 3280)
@@ -36,5 +36,5 @@
 #include <ostream>
 
-#include "util/String.h"
+#include "util/StringUtils.h"
 #include "ConfigValueContainer.h"
 #include "ConsoleCommand.h"
Index: code/trunk/src/core/Language.cc
===================================================================
--- code/trunk/src/core/Language.cc	(revision 3279)
+++ code/trunk/src/core/Language.cc	(revision 3280)
@@ -194,5 +194,5 @@
         @return The filename
     */
-    const std::string Language::getFilename(const std::string& language)
+    std::string Language::getFilename(const std::string& language)
     {
         return std::string("translation_" + language + ".lang");
Index: code/trunk/src/core/Language.h
===================================================================
--- code/trunk/src/core/Language.h	(revision 3279)
+++ code/trunk/src/core/Language.h	(revision 3280)
@@ -114,5 +114,5 @@
     class _CoreExport Language
     {
-        friend class Core;
+        friend class CoreConfiguration;
 
         public:
@@ -130,5 +130,5 @@
             void readTranslatedLanguageFile();
             void writeDefaultLanguageFile() const;
-            static const std::string getFilename(const std::string& language);
+            static std::string getFilename(const std::string& language);
             LanguageEntry* createEntry(const LanguageEntryLabel& label, const std::string& entry);
 
Index: code/trunk/src/core/LuaBind.cc
===================================================================
--- code/trunk/src/core/LuaBind.cc	(revision 3279)
+++ code/trunk/src/core/LuaBind.cc	(revision 3280)
@@ -38,5 +38,5 @@
 
 #include "util/Debug.h"
-#include "util/String.h"
+#include "util/StringUtils.h"
 #include "ToluaBindCore.h"
 #include "Core.h"
Index: code/trunk/src/core/OrxonoxClass.cc
===================================================================
--- code/trunk/src/core/OrxonoxClass.cc	(revision 3279)
+++ code/trunk/src/core/OrxonoxClass.cc	(revision 3280)
@@ -78,40 +78,40 @@
 
     /** @brief Returns true if the objects class is of the given type or a derivative. */
-    bool OrxonoxClass::isA(const SubclassIdentifier<class B>* identifier)
+    template <class B> bool OrxonoxClass::isA(const SubclassIdentifier<B>* identifier)
         { return this->getIdentifier()->isA(identifier->getIdentifier()); }
     /** @brief Returns true if the objects class is exactly of the given type. */
-    bool OrxonoxClass::isExactlyA(const SubclassIdentifier<class B>* identifier)
+    template <class B> bool OrxonoxClass::isExactlyA(const SubclassIdentifier<B>* identifier)
         { return this->getIdentifier()->isExactlyA(identifier->getIdentifier()); }
     /** @brief Returns true if the objects class is a child of the given type. */
-    bool OrxonoxClass::isChildOf(const SubclassIdentifier<class B>* identifier)
+    template <class B> bool OrxonoxClass::isChildOf(const SubclassIdentifier<B>* identifier)
         { return this->getIdentifier()->isChildOf(identifier->getIdentifier()); }
     /** @brief Returns true if the objects class is a direct child of the given type. */
-    bool OrxonoxClass::isDirectChildOf(const SubclassIdentifier<class B>* identifier)
+    template <class B> bool OrxonoxClass::isDirectChildOf(const SubclassIdentifier<B>* identifier)
         { return this->getIdentifier()->isDirectChildOf(identifier->getIdentifier()); }
     /** @brief Returns true if the objects class is a parent of the given type. */
-    bool OrxonoxClass::isParentOf(const SubclassIdentifier<class B>* identifier)
+    template <class B> bool OrxonoxClass::isParentOf(const SubclassIdentifier<B>* identifier)
         { return this->getIdentifier()->isParentOf(identifier->getIdentifier()); }
     /** @brief Returns true if the objects class is a direct parent of the given type. */
-    bool OrxonoxClass::isDirectParentOf(const SubclassIdentifier<class B>* identifier)
+    template <class B> bool OrxonoxClass::isDirectParentOf(const SubclassIdentifier<B>* identifier)
         { return this->getIdentifier()->isDirectParentOf(identifier->getIdentifier()); }
 
 
     /** @brief Returns true if the objects class is of the given type or a derivative. */
-    bool OrxonoxClass::isA(const SubclassIdentifier<class B> identifier)
+    template <class B> bool OrxonoxClass::isA(const SubclassIdentifier<B> identifier)
         { return this->getIdentifier()->isA(identifier.getIdentifier()); }
     /** @brief Returns true if the objects class is exactly of the given type. */
-    bool OrxonoxClass::isExactlyA(const SubclassIdentifier<class B> identifier)
+    template <class B> bool OrxonoxClass::isExactlyA(const SubclassIdentifier<B> identifier)
         { return this->getIdentifier()->isExactlyA(identifier.getIdentifier()); }
     /** @brief Returns true if the objects class is a child of the given type. */
-    bool OrxonoxClass::isChildOf(const SubclassIdentifier<class B> identifier)
+    template <class B> bool OrxonoxClass::isChildOf(const SubclassIdentifier<B> identifier)
         { return this->getIdentifier()->isChildOf(identifier.getIdentifier()); }
     /** @brief Returns true if the objects class is a direct child of the given type. */
-    bool OrxonoxClass::isDirectChildOf(const SubclassIdentifier<class B> identifier)
+    template <class B> bool OrxonoxClass::isDirectChildOf(const SubclassIdentifier<B> identifier)
         { return this->getIdentifier()->isDirectChildOf(identifier.getIdentifier()); }
     /** @brief Returns true if the objects class is a parent of the given type. */
-    bool OrxonoxClass::isParentOf(const SubclassIdentifier<class B> identifier)
+    template <class B> bool OrxonoxClass::isParentOf(const SubclassIdentifier<B> identifier)
         { return this->getIdentifier()->isParentOf(identifier.getIdentifier()); }
     /** @brief Returns true if the objects class is a direct parent of the given type. */
-    bool OrxonoxClass::isDirectParentOf(const SubclassIdentifier<class B> identifier)
+    template <class B> bool OrxonoxClass::isDirectParentOf(const SubclassIdentifier<B> identifier)
         { return this->getIdentifier()->isDirectParentOf(identifier.getIdentifier()); }
 
Index: code/trunk/src/core/OrxonoxClass.h
===================================================================
--- code/trunk/src/core/OrxonoxClass.h	(revision 3279)
+++ code/trunk/src/core/OrxonoxClass.h	(revision 3280)
@@ -80,17 +80,17 @@
             bool isDirectParentOf(const Identifier* identifier);
 
-            bool isA(const SubclassIdentifier<class B>* identifier);
-            bool isExactlyA(const SubclassIdentifier<class B>* identifier);
-            bool isChildOf(const SubclassIdentifier<class B>* identifier);
-            bool isDirectChildOf(const SubclassIdentifier<class B>* identifier);
-            bool isParentOf(const SubclassIdentifier<class B>* identifier);
-            bool isDirectParentOf(const SubclassIdentifier<class B>* identifier);
+            template <class B> bool isA(const SubclassIdentifier<B>* identifier);
+            template <class B> bool isExactlyA(const SubclassIdentifier<B>* identifier);
+            template <class B> bool isChildOf(const SubclassIdentifier<B>* identifier);
+            template <class B> bool isDirectChildOf(const SubclassIdentifier<B>* identifier);
+            template <class B> bool isParentOf(const SubclassIdentifier<B>* identifier);
+            template <class B> bool isDirectParentOf(const SubclassIdentifier<B>* identifier);
 
-            bool isA(const SubclassIdentifier<class B> identifier);
-            bool isExactlyA(const SubclassIdentifier<class B> identifier);
-            bool isChildOf(const SubclassIdentifier<class B> identifier);
-            bool isDirectChildOf(const SubclassIdentifier<class B> identifier);
-            bool isParentOf(const SubclassIdentifier<class B> identifier);
-            bool isDirectParentOf(const SubclassIdentifier<class B> identifier);
+            template <class B> bool isA(const SubclassIdentifier<B> identifier);
+            template <class B> bool isExactlyA(const SubclassIdentifier<B> identifier);
+            template <class B> bool isChildOf(const SubclassIdentifier<B> identifier);
+            template <class B> bool isDirectChildOf(const SubclassIdentifier<B> identifier);
+            template <class B> bool isParentOf(const SubclassIdentifier<B> identifier);
+            template <class B> bool isDirectParentOf(const SubclassIdentifier<B> identifier);
 
             bool isA(const OrxonoxClass* object);
Index: code/trunk/src/core/Shell.cc
===================================================================
--- code/trunk/src/core/Shell.cc	(revision 3279)
+++ code/trunk/src/core/Shell.cc	(revision 3280)
@@ -78,4 +78,8 @@
         OutputHandler::getOutStream().setOutputBuffer(&this->outputBuffer_);
 
+        // Get a config file for the command history
+        this->commandHistoryConfigFileType_ = ConfigFileManager::getInstance().getNewConfigFileType();
+        ConfigFileManager::getInstance().setFilename(this->commandHistoryConfigFileType_, "commandHistory.ini");
+
         this->setConfigValues();
 
@@ -93,7 +97,9 @@
     void Shell::setConfigValues()
     {
-        SetConfigValue(maxHistoryLength_, 100).callback(this, &Shell::commandHistoryLengthChanged);
-        SetConfigValue(historyOffset_, 0).callback(this, &Shell::commandHistoryOffsetChanged);
-        SetConfigValueVector(commandHistory_, std::vector<std::string>());
+        SetConfigValueGeneric(commandHistoryConfigFileType_, maxHistoryLength_, 100)
+            .callback(this, &Shell::commandHistoryLengthChanged);
+        SetConfigValueGeneric(commandHistoryConfigFileType_, historyOffset_, 0)
+            .callback(this, &Shell::commandHistoryOffsetChanged);
+        SetConfigValueVectorGeneric(commandHistoryConfigFileType_, commandHistory_, std::vector<std::string>());
     }
 
Index: code/trunk/src/core/Shell.h
===================================================================
--- code/trunk/src/core/Shell.h	(revision 3279)
+++ code/trunk/src/core/Shell.h	(revision 3280)
@@ -37,7 +37,8 @@
 #include <vector>
 
+#include "util/OutputBuffer.h"
+#include "input/InputBuffer.h"
 #include "OrxonoxClass.h"
-#include "input/InputBuffer.h"
-#include "util/OutputBuffer.h"
+#include "ConfigFileManager.h"
 
 namespace orxonox
@@ -145,4 +146,6 @@
             bool bAddOutputLevel_;
 
+            ConfigFileType commandHistoryConfigFileType_;
+
             static Shell* singletonRef_s;
     };
Index: code/trunk/src/core/TclBind.cc
===================================================================
--- code/trunk/src/core/TclBind.cc	(revision 3279)
+++ code/trunk/src/core/TclBind.cc	(revision 3280)
@@ -34,5 +34,5 @@
 
 #include "util/Debug.h"
-#include "util/String.h"
+#include "util/StringUtils.h"
 #include "CommandExecutor.h"
 #include "ConsoleCommand.h"
Index: code/trunk/src/core/TclThreadManager.cc
===================================================================
--- code/trunk/src/core/TclThreadManager.cc	(revision 3279)
+++ code/trunk/src/core/TclThreadManager.cc	(revision 3280)
@@ -94,5 +94,5 @@
         boost::mutex::scoped_lock bundles_lock(TclThreadManager::getInstance().bundlesMutex_);
         TclThreadManager::getInstance().threadCounter_++;
-        std::string name = getConvertedValue<unsigned int, std::string>(TclThreadManager::getInstance().threadCounter_);
+        std::string name = multi_cast<std::string>(TclThreadManager::getInstance().threadCounter_);
 
         TclInterpreterBundle* bundle = new TclInterpreterBundle;
@@ -192,5 +192,5 @@
         {
             boost::mutex::scoped_lock queue_lock(TclThreadManager::getInstance().orxonoxInterpreterBundle_.queueMutex_);
-            output += getConvertedValue<unsigned int, std::string>(TclThreadManager::getInstance().orxonoxInterpreterBundle_.queue_.size());
+            output += multi_cast<std::string>(TclThreadManager::getInstance().orxonoxInterpreterBundle_.queue_.size());
         }
         output += "\t\t";
@@ -201,9 +201,9 @@
         for (std::map<unsigned int, TclInterpreterBundle*>::const_iterator it = TclThreadManager::getInstance().interpreterBundles_.begin(); it != TclThreadManager::getInstance().interpreterBundles_.end(); ++it)
         {
-            std::string output = getConvertedValue<unsigned int, std::string>((*it).first);
+            std::string output = multi_cast<std::string>((*it).first);
             output += "\t\t";
             {
                 boost::mutex::scoped_lock queue_lock((*it).second->queueMutex_);
-                output += getConvertedValue<unsigned int, std::string>((*it).second->queue_.size());
+                output += multi_cast<std::string>((*it).second->queue_.size());
             }
             output += "\t\t";
@@ -342,5 +342,5 @@
         else
         {
-            this->error("Error: No Tcl-interpreter with ID " + getConvertedValue<unsigned int, std::string>(threadID) + " existing.");
+            this->error("Error: No Tcl-interpreter with ID " + multi_cast<std::string>(threadID) + " existing.");
             return 0;
         }
@@ -355,5 +355,5 @@
                 output += " ";
 
-            output += getConvertedValue<unsigned int, std::string>(*it);
+            output += multi_cast<std::string>(*it);
         }
         return output;
@@ -444,5 +444,5 @@
             if (bundle->queue_.size() >= TCLTHREADMANAGER_MAX_QUEUE_LENGTH)
             {
-                this->error("Error: Queue of Tcl-interpreter " + getConvertedValue<unsigned int, std::string>(threadID) + " is full, couldn't add command.");
+                this->error("Error: Queue of Tcl-interpreter " + multi_cast<std::string>(threadID) + " is full, couldn't add command.");
                 return;
             }
@@ -492,5 +492,5 @@
         if (std::find(target->queriers_.begin(), target->queriers_.end(), target->id_) != target->queriers_.end())
         {
-            this->error("Error: Circular query (" + this->dumpList(target->queriers_) + " -> " + getConvertedValue<unsigned int, std::string>(target->id_) + "), couldn't query Tcl-interpreter with ID " + getConvertedValue<unsigned int, std::string>(target->id_) + " from other interpreter with ID " + getConvertedValue<unsigned int, std::string>(querier->id_) + ".");
+            this->error("Error: Circular query (" + this->dumpList(target->queriers_) + " -> " + multi_cast<std::string>(target->id_) + "), couldn't query Tcl-interpreter with ID " + multi_cast<std::string>(target->id_) + " from other interpreter with ID " + multi_cast<std::string>(querier->id_) + ".");
             return false;
         }
@@ -585,5 +585,5 @@
                     else
                     {
-                        this->error("Error: Couldn't query Tcl-interpreter with ID " + getConvertedValue<unsigned int, std::string>(threadID) + ", interpreter is busy right now.");
+                        this->error("Error: Couldn't query Tcl-interpreter with ID " + multi_cast<std::string>(threadID) + ", interpreter is busy right now.");
                     }
                 }
@@ -665,9 +665,9 @@
         catch (Tcl::tcl_error const &e)
         {
-            TclThreadManager::getInstance().error("Tcl (ID " + getConvertedValue<unsigned int, std::string>(interpreterBundle->id_) + ") error: " + e.what());
+            TclThreadManager::getInstance().error("Tcl (ID " + multi_cast<std::string>(interpreterBundle->id_) + ") error: " + e.what());
         }
         catch (std::exception const &e)
         {
-            TclThreadManager::getInstance().error("Error while executing Tcl (ID " + getConvertedValue<unsigned int, std::string>(interpreterBundle->id_) + "): " + e.what());
+            TclThreadManager::getInstance().error("Error while executing Tcl (ID " + multi_cast<std::string>(interpreterBundle->id_) + "): " + e.what());
         }
 
Index: code/trunk/src/core/input/Button.cc
===================================================================
--- code/trunk/src/core/input/Button.cc	(revision 3279)
+++ code/trunk/src/core/input/Button.cc	(revision 3280)
@@ -37,5 +37,5 @@
 #include "util/Convert.h"
 #include "util/SubString.h"
-#include "util/String.h"
+#include "util/StringUtils.h"
 #include "util/Debug.h"
 #include "core/ConsoleCommand.h"
@@ -127,5 +127,5 @@
                     '\\', false, '"', false, '(', ')', false, '\0');
 
-                KeybindMode::Enum mode = KeybindMode::None;
+                KeybindMode::Value mode = KeybindMode::None;
                 float paramModifier = 1.0f;
                 std::string commandStr = "";
Index: code/trunk/src/core/input/Button.h
===================================================================
--- code/trunk/src/core/input/Button.h	(revision 3279)
+++ code/trunk/src/core/input/Button.h	(revision 3280)
@@ -54,5 +54,5 @@
         void parse();
         void readConfigValue(ConfigFileType configFile);
-        bool execute(KeybindMode::Enum mode, float abs = 1.0f, float rel = 1.0f);
+        bool execute(KeybindMode::Value mode, float abs = 1.0f, float rel = 1.0f);
 
         //! Container to allow for better configValue support
@@ -79,5 +79,5 @@
     };
 
-    inline bool Button::execute(KeybindMode::Enum mode, float abs, float rel)
+    inline bool Button::execute(KeybindMode::Value mode, float abs, float rel)
     {
         // execute all the parsed commands in the string
Index: code/trunk/src/core/input/InputManager.cc
===================================================================
--- code/trunk/src/core/input/InputManager.cc	(revision 3279)
+++ code/trunk/src/core/input/InputManager.cc	(revision 3280)
@@ -43,5 +43,5 @@
 #include "util/Convert.h"
 #include "util/Exception.h"
-#include "util/Debug.h"
+#include "util/ScopeGuard.h"
 #include "core/Clock.h"
 #include "core/CoreIncludes.h"
@@ -70,5 +70,5 @@
     SetConsoleCommand(InputManager, ungrabMouse, true);
 #endif
-    SetCommandLineSwitch(keyboard_no_grab);
+    SetCommandLineSwitch(keyboard_no_grab).information("Whether not to exclusively grab the keyboard");
 
     EmptyHandler InputManager::EMPTY_HANDLER;
@@ -177,7 +177,10 @@
             windowHndStr << (unsigned int)windowHnd_;
             paramList.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
+#if defined(ORXONOX_PLATFORM_WINDOWS)
             //paramList.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_NONEXCLUSIVE")));
             //paramList.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_FOREGROUND")));
-#if defined ORXONOX_PLATFORM_LINUX
+            //paramList.insert(std::make_pair(std::string("w32_keyboard"), std::string("DISCL_NONEXCLUSIVE")));
+            //paramList.insert(std::make_pair(std::string("w32_keyboard"), std::string("DISCL_FOREGROUND")));
+#elif defined(ORXONOX_PLATFORM_LINUX)
             paramList.insert(std::make_pair(std::string("XAutoRepeatOn"), std::string("true")));
             paramList.insert(std::make_pair(std::string("x11_mouse_grab"), "true"));
@@ -191,8 +194,20 @@
 #endif
 
-            inputSystem_ = OIS::InputManager::createInputSystem(paramList);
-            CCOUT(ORX_DEBUG) << "Created OIS input system" << std::endl;
-
-            _initialiseKeyboard();
+            try
+            {
+                inputSystem_ = OIS::InputManager::createInputSystem(paramList);
+                // Exception-safety
+                Loki::ScopeGuard guard = Loki::MakeGuard(OIS::InputManager::destroyInputSystem, inputSystem_);
+                CCOUT(ORX_DEBUG) << "Created OIS input system" << std::endl;
+
+                _initialiseKeyboard();
+
+                // Nothing below should throw anymore, dismiss the guard
+                guard.Dismiss();
+            }
+            catch (OIS::Exception& ex)
+            {
+                ThrowException(InitialisationFailed, "Could not initialise the input system: " << ex.what());
+            }
 
             _initialiseMouse();
@@ -200,5 +215,5 @@
             if (joyStickSupport)
                 _initialiseJoySticks();
-            // Do this anyway to also inform everything when a joystick was detached.
+            // Do this anyway to also inform when a joystick was detached.
             _configureJoySticks();
 
@@ -273,5 +288,5 @@
         else
         {
-            ThrowException(InitialisationFailed, "No keyboard found!");
+            ThrowException(InitialisationFailed, "InputManager: No keyboard found, cannot proceed!");
         }
     }
@@ -301,5 +316,5 @@
             else
             {
-                CCOUT(ORX_WARNING) << "Warning: No mouse found!" << std::endl;
+                CCOUT(ORX_WARNING) << "Warning: No mouse found! Proceeding without mouse support." << std::endl;
             }
         }
@@ -307,5 +322,5 @@
         {
             CCOUT(ORX_WARNING) << "Warning: Failed to create an OIS mouse\n"
-                << "OIS error message: \"" << ex.eText << "\"" << std::endl;
+                << "OIS error message: \"" << ex.eText << "\"\n Proceeding without mouse support." << std::endl;
             mouse_ = 0;
         }
@@ -345,8 +360,4 @@
             }
         }
-        else
-        {
-            //CCOUT(ORX_WARNING) << "Warning: Joy stick support requested, but no joy stick was found" << std::endl;
-        }
     }
 
@@ -528,41 +539,38 @@
         if (internalState_ != Uninitialised)
         {
+            CCOUT(3) << "Destroying ..." << std::endl;
+
+            // kick all active states 'nicely'
+            for (std::map<int, InputState*>::reverse_iterator rit = activeStates_.rbegin();
+                rit != activeStates_.rend(); ++rit)
+            {
+                (*rit).second->onLeave();
+            }
+
+            // Destroy calibrator helper handler and state
+            delete keyDetector_;
+            requestDestroyState("calibrator");
+            // Destroy KeyDetector and state
+            delete calibratorCallbackBuffer_;
+            requestDestroyState("detector");
+            // destroy the empty InputState
+            _destroyState(this->stateEmpty_);
+
+            // destroy all user InputStates
+            while (inputStatesByName_.size() > 0)
+                _destroyState((*inputStatesByName_.rbegin()).second);
+
+            // destroy the devices
+            _destroyKeyboard();
+            _destroyMouse();
+            _destroyJoySticks();
+
             try
             {
-                CCOUT(3) << "Destroying ..." << std::endl;
-
-                // kick all active states 'nicely'
-                for (std::map<int, InputState*>::reverse_iterator rit = activeStates_.rbegin();
-                    rit != activeStates_.rend(); ++rit)
-                {
-                    (*rit).second->onLeave();
-                }
-
-                // Destroy calibrator helper handler and state
-                delete keyDetector_;
-                requestDestroyState("calibrator");
-                // Destroy KeyDetector and state
-                delete calibratorCallbackBuffer_;
-                requestDestroyState("detector");
-                // destroy the empty InputState
-                _destroyState(this->stateEmpty_);
-
-                // destroy all user InputStates
-                while (inputStatesByName_.size() > 0)
-                    _destroyState((*inputStatesByName_.rbegin()).second);
-
-                // destroy the devices
-                _destroyKeyboard();
-                _destroyMouse();
-                _destroyJoySticks();
-
                 OIS::InputManager::destroyInputSystem(inputSystem_);
-
-                CCOUT(3) << "Destroying done." << std::endl;
-            }
-            catch (OIS::Exception& ex)
-            {
-                CCOUT(1) << "An exception has occured while destroying:\n" << ex.what()
-                         << "This could lead to a possible memory/resource leak!" << std::endl;
+            }
+            catch (...)
+            {
+                CCOUT(1) << "OIS::InputManager destruction failed! Potential resource leak!" << std::endl;
             }
         }
@@ -578,8 +586,15 @@
     {
         assert(inputSystem_);
-        if (keyboard_)
-            inputSystem_->destroyInputObject(keyboard_);
-        keyboard_ = 0;
-        CCOUT(4) << "Keyboard destroyed." << std::endl;
+        try
+        {
+            if (keyboard_)
+                inputSystem_->destroyInputObject(keyboard_);
+            keyboard_ = 0;
+            CCOUT(4) << "Keyboard destroyed." << std::endl;
+        }
+        catch (...)
+        {
+            CCOUT(1) << "Keyboard destruction failed! Potential resource leak!" << std::endl;
+        }
     }
 
@@ -591,8 +606,15 @@
     {
         assert(inputSystem_);
-        if (mouse_)
-            inputSystem_->destroyInputObject(mouse_);
-        mouse_ = 0;
-        CCOUT(4) << "Mouse destroyed." << std::endl;
+        try
+        {
+            if (mouse_)
+                inputSystem_->destroyInputObject(mouse_);
+            mouse_ = 0;
+            CCOUT(4) << "Mouse destroyed." << std::endl;
+        }
+        catch (...)
+        {
+            CCOUT(1) << "Mouse destruction failed! Potential resource leak!" << std::endl;
+        }
     }
 
@@ -607,6 +629,15 @@
             assert(inputSystem_);
             for (unsigned int i = 0; i < joySticksSize_; i++)
-                if (joySticks_[i] != 0)
-                    inputSystem_->destroyInputObject(joySticks_[i]);
+            {
+                try
+                {
+                    if (joySticks_[i] != 0)
+                        inputSystem_->destroyInputObject(joySticks_[i]);
+                }
+                catch (...)
+                {
+                    CCOUT(1) << "Joy stick destruction failed! Potential resource leak!" << std::endl;
+                }
+            }
 
             joySticks_.clear();
Index: code/trunk/src/core/input/KeyBinder.cc
===================================================================
--- code/trunk/src/core/input/KeyBinder.cc	(revision 3279)
+++ code/trunk/src/core/input/KeyBinder.cc	(revision 3280)
@@ -96,6 +96,6 @@
         }
 
-        // Get a new ConfigFileType from the ConfigFileManager
-        this->configFile_ = ConfigFileManager::getInstance().getNewConfigFileType();
+        // We might not even load any bindings at all (KeyDetector for instance)
+        this->configFile_ = ConfigFileType::NoType;
 
         // initialise joy sticks separatly to allow for reloading
@@ -187,5 +187,5 @@
         for (unsigned int iDev = 0; iDev < numberOfJoySticks_; iDev++)
         {
-            std::string deviceNumber = convertToString(iDev);
+            std::string deviceNumber = multi_cast<std::string>(iDev);
             // joy stick buttons
             for (unsigned int i = 0; i < JoyStickButtonCode::numberOfButtons; i++)
@@ -249,4 +249,10 @@
         if (filename.empty())
             return;
+
+        if (this->configFile_ == ConfigFileType::NoType)
+        {
+            // Get a new ConfigFileType from the ConfigFileManager
+            this->configFile_ = ConfigFileManager::getInstance().getNewConfigFileType();
+        }
 
         ConfigFileManager::getInstance().setFilename(this->configFile_, filename);
Index: code/trunk/src/network/NetworkPrereqs.h
===================================================================
--- code/trunk/src/network/NetworkPrereqs.h	(revision 3279)
+++ code/trunk/src/network/NetworkPrereqs.h	(revision 3280)
@@ -132,5 +132,5 @@
     namespace PacketFlag
     {
-      enum Enum
+      enum Value
       {
         Reliable   = 1,
Index: code/trunk/src/network/packet/Acknowledgement.cc
===================================================================
--- code/trunk/src/network/packet/Acknowledgement.cc	(revision 3279)
+++ code/trunk/src/network/packet/Acknowledgement.cc	(revision 3280)
@@ -37,5 +37,5 @@
 #define PACKET_FLAGS_ACK    0
 #define _PACKETID           0
-#define _ACKID              _PACKETID + sizeof(packet::ENUM::Type)
+#define _ACKID              _PACKETID + sizeof(packet::Type::Value)
   
 Acknowledgement::Acknowledgement( unsigned int id, unsigned int clientID )
@@ -44,5 +44,5 @@
   flags_ = flags_ | PACKET_FLAGS_ACK;
   data_=new uint8_t[ getSize() ];
-  *(ENUM::Type *)(data_ + _PACKETID ) = ENUM::Acknowledgement;
+  *(Type::Value *)(data_ + _PACKETID ) = Type::Acknowledgement;
   *(uint32_t *)(data_ + _ACKID ) = id;
   clientID_=clientID;
Index: code/trunk/src/network/packet/Chat.cc
===================================================================
--- code/trunk/src/network/packet/Chat.cc	(revision 3279)
+++ code/trunk/src/network/packet/Chat.cc	(revision 3280)
@@ -38,5 +38,5 @@
 #define   PACKET_FLAGS_CHAT PacketFlag::Reliable
 #define   _PACKETID         0
-const int _PLAYERID     =   _PACKETID + sizeof(ENUM::Type);
+const int _PLAYERID     =   _PACKETID + sizeof(Type::Value);
 #define   _MESSAGELENGTH    _PLAYERID + sizeof(uint32_t)
 #define   _MESSAGE          _MESSAGELENGTH + sizeof(uint32_t)
@@ -48,5 +48,5 @@
   messageLength_ = message.length()+1;
   data_=new unsigned char[ getSize() ];
-  *(ENUM::Type *)(data_ + _PACKETID ) = ENUM::Chat;
+  *(Type::Value *)(data_ + _PACKETID ) = Type::Chat;
   *(unsigned int *)(data_ + _PLAYERID ) = playerID;
   *(unsigned int *)(data_ + _MESSAGELENGTH ) = messageLength_;
Index: code/trunk/src/network/packet/ClassID.cc
===================================================================
--- code/trunk/src/network/packet/ClassID.cc	(revision 3279)
+++ code/trunk/src/network/packet/ClassID.cc	(revision 3280)
@@ -74,5 +74,5 @@
   //set the appropriate packet id
   assert(this->data_);
-  *(ENUM::Type *)(this->data_ + _PACKETID ) = ENUM::ClassID;
+  *(Type::Value *)(this->data_ + _PACKETID ) = Type::ClassID;
   
   uint8_t *temp=data_+sizeof(uint32_t);
Index: code/trunk/src/network/packet/DeleteObjects.cc
===================================================================
--- code/trunk/src/network/packet/DeleteObjects.cc	(revision 3279)
+++ code/trunk/src/network/packet/DeleteObjects.cc	(revision 3280)
@@ -39,5 +39,5 @@
 #define PACKET_FLAG_DELETE  PacketFlag::Reliable
 #define _PACKETID           0
-#define _QUANTITY           _PACKETID + sizeof(ENUM::Type)
+#define _QUANTITY           _PACKETID + sizeof(Type::Value)
 #define _OBJECTIDS          _QUANTITY + sizeof(uint32_t)
   
@@ -62,9 +62,9 @@
     return false;
   COUT(4) << "sending DeleteObjects: ";
-  unsigned int size = sizeof(ENUM::Type) + sizeof(uint32_t)*(number+1);
+  unsigned int size = sizeof(Type::Value) + sizeof(uint32_t)*(number+1);
   data_ = new uint8_t[size];
   uint8_t *tdata = data_;
-  *reinterpret_cast<ENUM::Type*>(tdata) = ENUM::DeleteObjects;
-  tdata += sizeof(ENUM::Type);
+  *reinterpret_cast<Type::Value*>(tdata) = Type::DeleteObjects;
+  tdata += sizeof(Type::Value);
   *(uint32_t *)tdata = number;
   tdata += sizeof(uint32_t);
Index: code/trunk/src/network/packet/FunctionCalls.cc
===================================================================
--- code/trunk/src/network/packet/FunctionCalls.cc	(revision 3279)
+++ code/trunk/src/network/packet/FunctionCalls.cc	(revision 3280)
@@ -49,5 +49,5 @@
   currentMemBlocks_ = 1;
   data_=new uint8_t[ FUNCTIONCALLS_MEM_ALLOCATION ];
-  *(ENUM::Type *)(data_ + _PACKETID ) = ENUM::FunctionCalls;
+  *(Type::Value *)(data_ + _PACKETID ) = Type::FunctionCalls;
   *(uint32_t*)(data_+sizeof(uint32_t)) = 0; // set nrOfCalls to 0
 }
Index: code/trunk/src/network/packet/FunctionIDs.cc
===================================================================
--- code/trunk/src/network/packet/FunctionIDs.cc	(revision 3279)
+++ code/trunk/src/network/packet/FunctionIDs.cc	(revision 3280)
@@ -68,5 +68,5 @@
   //set the appropriate packet id
   assert(this->data_);
-  *(ENUM::Type *)(this->data_ + _PACKETID ) = ENUM::FunctionIDs;
+  *(Type::Value *)(this->data_ + _PACKETID ) = Type::FunctionIDs;
   
   uint8_t *temp=data_+sizeof(uint32_t);
Index: code/trunk/src/network/packet/Gamestate.h
===================================================================
--- code/trunk/src/network/packet/Gamestate.h	(revision 3279)
+++ code/trunk/src/network/packet/Gamestate.h	(revision 3280)
@@ -47,5 +47,5 @@
 class _NetworkExport GamestateHeader{
   public:
-    GamestateHeader(uint8_t *data){ assert(data); data_ = data; *(uint32_t*)data_ = ENUM::Gamestate; }
+    GamestateHeader(uint8_t *data){ assert(data); data_ = data; *(uint32_t*)data_ = Type::Gamestate; }
     GamestateHeader(uint8_t *data, GamestateHeader* h)
     { assert(data); data_=data; memcpy(data_, h->data_, getSize()); }
Index: code/trunk/src/network/packet/Packet.cc
===================================================================
--- code/trunk/src/network/packet/Packet.cc	(revision 3279)
+++ code/trunk/src/network/packet/Packet.cc	(revision 3280)
@@ -63,5 +63,5 @@
 Packet::Packet(){
   flags_ = PACKET_FLAG_DEFAULT;
-  packetDirection_ = ENUM::Outgoing;
+  packetDirection_ = Direction::Outgoing;
   clientID_=0;
   data_=0;
@@ -76,5 +76,5 @@
 Packet::Packet(uint8_t *data, unsigned int clientID){
   flags_ = PACKET_FLAG_DEFAULT;
-  packetDirection_ = ENUM::Incoming;
+  packetDirection_ = Direction::Incoming;
   clientID_=clientID;
   data_=data;
@@ -125,5 +125,5 @@
 
 bool Packet::send(){
-  if(packetDirection_ != ENUM::Outgoing && packetDirection_ != ENUM::Bidirectional ){
+  if(packetDirection_ != Direction::Outgoing && packetDirection_ != Direction::Bidirectional ){
     assert(0);
     return false;
@@ -147,14 +147,14 @@
   }
 #ifndef NDEBUG
-  switch( *(ENUM::Type *)(data_ + _PACKETID) )
+  switch( *(Type::Value *)(data_ + _PACKETID) )
   {
-    case ENUM::Acknowledgement:
-    case ENUM::Chat:
-    case ENUM::ClassID:
-    case ENUM::Gamestate:
-    case ENUM::Welcome:
-    case ENUM::DeleteObjects:
-    case ENUM::FunctionIDs:
-    case ENUM::FunctionCalls:
+    case Type::Acknowledgement:
+    case Type::Chat:
+    case Type::ClassID:
+    case Type::Gamestate:
+    case Type::Welcome:
+    case Type::DeleteObjects:
+    case Type::FunctionIDs:
+    case Type::FunctionCalls:
       break;
     default:
@@ -175,37 +175,37 @@
   unsigned int clientID = ClientInformation::findClient(&peer->address)->getID();
   Packet *p = 0;
-  COUT(6) << "packet type: " << *(ENUM::Type *)&data[_PACKETID] << std::endl;
-  switch( *(ENUM::Type *)(data + _PACKETID) )
+  COUT(6) << "packet type: " << *(Type::Value *)&data[_PACKETID] << std::endl;
+  switch( *(Type::Value *)(data + _PACKETID) )
   {
-    case ENUM::Acknowledgement:
+    case Type::Acknowledgement:
       COUT(5) << "ack" << std::endl;
       p = new Acknowledgement( data, clientID );
       break;
-    case ENUM::Chat:
+    case Type::Chat:
       COUT(5) << "chat" << std::endl;
       p = new Chat( data, clientID );
       break;
-    case ENUM::ClassID:
+    case Type::ClassID:
       COUT(5) << "classid" << std::endl;
       p = new ClassID( data, clientID );
       break;
-    case ENUM::Gamestate:
+    case Type::Gamestate:
       COUT(5) << "gamestate" << std::endl;
       // TODO: remove brackets
       p = new Gamestate( data, clientID );
       break;
-    case ENUM::Welcome:
+    case Type::Welcome:
       COUT(5) << "welcome" << std::endl;
       p = new Welcome( data, clientID );
       break;
-    case ENUM::DeleteObjects:
+    case Type::DeleteObjects:
       COUT(5) << "deleteobjects" << std::endl;
       p = new DeleteObjects( data, clientID );
       break;
-    case ENUM::FunctionCalls:
+    case Type::FunctionCalls:
       COUT(5) << "functionCalls" << std::endl;
       p = new FunctionCalls( data, clientID );
       break;
-    case ENUM::FunctionIDs:
+    case Type::FunctionIDs:
       COUT(5) << "functionIDs" << std::endl;
       p = new FunctionIDs( data, clientID );
Index: code/trunk/src/network/packet/Packet.h
===================================================================
--- code/trunk/src/network/packet/Packet.h	(revision 3279)
+++ code/trunk/src/network/packet/Packet.h	(revision 3280)
@@ -36,11 +36,13 @@
 namespace packet{
 
-namespace ENUM{
-  enum Direction{
+namespace Direction{
+  enum Value{
     Incoming,
     Outgoing,
     Bidirectional
   };
-  enum Type{
+}
+namespace Type{
+  enum Value{
     Acknowledgement,
     Chat,
@@ -84,5 +86,5 @@
     uint32_t flags_;
     unsigned int clientID_;
-    ENUM::Direction packetDirection_;
+    Direction::Value packetDirection_;
     /** Pointer to the data. Be careful when deleting it because it might
         point to a location that was allocated by ENet.
Index: code/trunk/src/network/packet/Welcome.cc
===================================================================
--- code/trunk/src/network/packet/Welcome.cc	(revision 3279)
+++ code/trunk/src/network/packet/Welcome.cc	(revision 3280)
@@ -41,5 +41,5 @@
 #define PACKET_FLAGS_CLASSID  PacketFlag::Reliable
 #define _PACKETID             0
-#define _CLIENTID             _PACKETID + sizeof(ENUM::Type)
+#define _CLIENTID             _PACKETID + sizeof(Type::Value)
 #define _ENDIANTEST           _CLIENTID + sizeof(uint32_t)
 
@@ -51,5 +51,5 @@
   data_=new uint8_t[ getSize() ];
   assert(data_);
-  *(packet::ENUM::Type *)(data_ + _PACKETID ) = packet::ENUM::Welcome;
+  *(packet::Type::Value *)(data_ + _PACKETID ) = packet::Type::Welcome;
   *(uint32_t *)(data_ + _CLIENTID ) = static_cast<uint32_t>(clientID);
   *(uint32_t *)(data_ + _ENDIANTEST ) = 0xFEDC4321;
@@ -70,5 +70,5 @@
 
 unsigned int Welcome::getSize() const{
-  return sizeof(packet::ENUM::Type) + 2*sizeof(uint32_t);
+  return sizeof(packet::Type::Value) + 2*sizeof(uint32_t);
 }
 
Index: code/trunk/src/network/synchronisable/Synchronisable.cc
===================================================================
--- code/trunk/src/network/synchronisable/Synchronisable.cc	(revision 3279)
+++ code/trunk/src/network/synchronisable/Synchronisable.cc	(revision 3280)
@@ -65,5 +65,5 @@
     this->dataSize_ = 0;
     // set standard priority
-    this->setPriority( priority::normal );
+    this->setPriority( Priority::Normal );
 
     // get creator id
Index: code/trunk/src/network/synchronisable/Synchronisable.h
===================================================================
--- code/trunk/src/network/synchronisable/Synchronisable.h	(revision 3279)
+++ code/trunk/src/network/synchronisable/Synchronisable.h	(revision 3280)
@@ -51,19 +51,19 @@
 {
 
-  namespace objectDirection{
-    enum objectdirection{
-      toclient=0x1,
-      toserver=0x2,
-      bidirectional=0x3
+  namespace ObjectDirection{
+    enum Value{
+      ToClient=0x1,
+      ToServer=0x2,
+      Bidirectional=0x3
     };
   }
 
-  namespace priority{
-    enum prio{
-      very_high   = -100,
-      high        = -15,
-      normal      = 0,
-      low         = 15,
-      very_low    = 100
+  namespace Priority{
+    enum Value{
+      VeryHigh    = -100,
+      High        = -15,
+      Normal      = 0,
+      Low         = 15,
+      VeryLow     = 100
     };
   }
Index: code/trunk/src/network/synchronisable/SynchronisableVariable.h
===================================================================
--- code/trunk/src/network/synchronisable/SynchronisableVariable.h	(revision 3279)
+++ code/trunk/src/network/synchronisable/SynchronisableVariable.h	(revision 3280)
@@ -41,12 +41,14 @@
 namespace orxonox{
   
-  namespace variableDirection{
-    enum syncdirection{
-      toclient=0x1,
-      toserver=0x2
+  namespace VariableDirection{
+    enum Value{
+      ToClient=0x1,
+      ToServer=0x2
     };
-    enum bidirectional{
-      serverMaster=0x1,
-      clientMaster=0x2
+  }
+  namespace Bidirectionality{
+    enum Value{
+      ServerMaster=0x1,
+      ClientMaster=0x2
     };
   }
@@ -69,5 +71,5 @@
   {
     public:
-      SynchronisableVariable(T& variable, uint8_t syncDirection=variableDirection::toclient, NetworkCallbackBase *cb=0);
+      SynchronisableVariable(T& variable, uint8_t syncDirection=VariableDirection::ToClient, NetworkCallbackBase *cb=0);
       virtual ~SynchronisableVariable();
 
@@ -88,5 +90,5 @@
   {
     public:
-      SynchronisableVariableBidirectional(T& variable, uint8_t master=variableDirection::serverMaster, NetworkCallbackBase *cb=0);
+      SynchronisableVariableBidirectional(T& variable, uint8_t master=Bidirectionality::ServerMaster, NetworkCallbackBase *cb=0);
       virtual ~SynchronisableVariableBidirectional();
       
Index: code/trunk/src/orxonox/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/CMakeLists.txt	(revision 3279)
+++ code/trunk/src/orxonox/CMakeLists.txt	(revision 3280)
@@ -42,4 +42,5 @@
   FIND_HEADER_FILES
   TOLUA_FILES
+    LevelManager.h
     gui/GUIManager.h
     objects/pickup/BaseItem.h
Index: code/trunk/src/orxonox/CameraManager.cc
===================================================================
--- code/trunk/src/orxonox/CameraManager.cc	(revision 3279)
+++ code/trunk/src/orxonox/CameraManager.cc	(revision 3280)
@@ -32,5 +32,5 @@
 #include <OgreCompositorManager.h>
 
-#include "util/String.h"
+#include "util/StringUtils.h"
 #include "core/GameMode.h"
 #include "core/ObjectList.h"
Index: code/trunk/src/orxonox/GraphicsManager.cc
===================================================================
--- code/trunk/src/orxonox/GraphicsManager.cc	(revision 3279)
+++ code/trunk/src/orxonox/GraphicsManager.cc	(revision 3280)
@@ -38,4 +38,5 @@
 #include <fstream>
 #include <boost/filesystem.hpp>
+#include <boost/shared_ptr.hpp>
 
 #include <OgreCompositorManager.h>
@@ -53,5 +54,5 @@
 #include "SpecialConfig.h"
 #include "util/Exception.h"
-#include "util/String.h"
+#include "util/StringUtils.h"
 #include "util/SubString.h"
 #include "core/Clock.h"
@@ -70,4 +71,6 @@
 namespace orxonox
 {
+    using boost::shared_ptr;
+
     class _OrxonoxExport OgreWindowEventListener : public Ogre::WindowEventListener
     {
@@ -89,5 +92,5 @@
         , renderWindow_(0)
         , viewport_(0)
-        , ogreWindowEventListener_(0)
+        , ogreWindowEventListener_(new OgreWindowEventListener())
     {
         RegisterObject(GraphicsManager);
@@ -96,30 +99,35 @@
         singletonRef_s = this;
 
-        this->loaded_ = false;
-
         this->setConfigValues();
-    }
-
-    void GraphicsManager::initialise()
-    {
+
         // Ogre setup procedure
         setupOgre();
-        // load all the required plugins for Ogre
-        loadOgrePlugins();
-        // read resource declaration file
-        this->declareResources();
-        // Reads ogre config and creates the render window
-        this->loadRenderer();
-
-        // TODO: Spread this
-        this->initialiseResources();
-
-        // add console commands
-        FunctorMember<GraphicsManager>* functor1 = createFunctor(&GraphicsManager::printScreen);
-        functor1->setObject(this);
-        ccPrintScreen_ = createConsoleCommand(functor1, "printScreen");
-        CommandExecutor::addConsoleCommandShortcut(ccPrintScreen_);
-
-        this->loaded_ = true;
+
+        try
+        {
+            // load all the required plugins for Ogre
+            loadOgrePlugins();
+            // read resource declaration file
+            this->declareResources();
+            // Reads ogre config and creates the render window
+            this->loadRenderer();
+
+            // TODO: Spread this
+            this->initialiseResources();
+
+            // add console commands
+            FunctorMember<GraphicsManager>* functor1 = createFunctor(&GraphicsManager::printScreen);
+            functor1->setObject(this);
+            ccPrintScreen_ = createConsoleCommand(functor1, "printScreen");
+            CommandExecutor::addConsoleCommandShortcut(ccPrintScreen_);
+        }
+        catch (...)
+        {
+            // clean up
+            delete this->ogreRoot_;
+            delete this->ogreLogger_;
+            delete this->ogreWindowEventListener_;
+            throw;
+        }
     }
 
@@ -130,33 +138,20 @@
     GraphicsManager::~GraphicsManager()
     {
-        if (this->loaded_)
-        {
-            delete this->ccPrintScreen_;
-
-            if (this->ogreWindowEventListener_)
-            {
-                // remove our WindowEventListener first to avoid bad calls after the window has been destroyed
-                Ogre::WindowEventUtilities::removeWindowEventListener(this->renderWindow_, this->ogreWindowEventListener_);
-                delete this->ogreWindowEventListener_;
-            }
-
-            // destroy render window
-//            Ogre::RenderSystem* renderer = this->ogreRoot_->getRenderSystem();
-//            renderer->destroyRenderWindow("Orxonox");
-
-            // HACK! This fixes an exit crash
-            Map::hackDestroyMap();
-
-            // unload all compositors
-            Ogre::CompositorManager::getSingleton().removeAll();
-
-            // Delete OGRE main control organ
-            delete this->ogreRoot_;
-
-            // delete the ogre log and the logManager (since we have created it in the first place).
-            this->ogreLogger_->getDefaultLog()->removeListener(this);
-            this->ogreLogger_->destroyLog(Ogre::LogManager::getSingleton().getDefaultLog());
-            delete this->ogreLogger_;
-        }
+/*
+        delete this->ccPrintScreen_;
+*/
+
+        // HACK! This fixes an exit crash
+        Map::hackDestroyMap();
+        // unload all compositors (this is only necessary because we don't yet destroy all resources!)
+        Ogre::CompositorManager::getSingleton().removeAll();
+
+        // Delete OGRE main control organ
+        delete this->ogreRoot_;
+
+        // delete the logManager (since we have created it in the first place).
+        delete this->ogreLogger_;
+
+        delete this->ogreWindowEventListener_;
 
         assert(singletonRef_s);
@@ -194,27 +189,24 @@
     void GraphicsManager::update(const Clock& time)
     {
-        if (this->loaded_)
-        {
-            Ogre::FrameEvent evt;
-            evt.timeSinceLastFrame = time.getDeltaTime();
-            evt.timeSinceLastEvent = time.getDeltaTime(); // note: same time, but shouldn't matter anyway
-
-            // don't forget to call _fireFrameStarted to OGRE to make sure
-            // everything goes smoothly
-            ogreRoot_->_fireFrameStarted(evt);
-
-            // Pump messages in all registered RenderWindows
-            // This calls the WindowEventListener objects.
-            Ogre::WindowEventUtilities::messagePump();
-            // make sure the window stays active even when not focused
-            // (probably only necessary on windows)
-            this->renderWindow_->setActive(true);
-
-            // render
-            ogreRoot_->_updateAllRenderTargets();
-
-            // again, just to be sure OGRE works fine
-            ogreRoot_->_fireFrameEnded(evt); // note: uses the same time as _fireFrameStarted
-        }
+        Ogre::FrameEvent evt;
+        evt.timeSinceLastFrame = time.getDeltaTime();
+        evt.timeSinceLastEvent = time.getDeltaTime(); // note: same time, but shouldn't matter anyway
+
+        // don't forget to call _fireFrameStarted to OGRE to make sure
+        // everything goes smoothly
+        ogreRoot_->_fireFrameStarted(evt);
+
+        // Pump messages in all registered RenderWindows
+        // This calls the WindowEventListener objects.
+        Ogre::WindowEventUtilities::messagePump();
+        // make sure the window stays active even when not focused
+        // (probably only necessary on windows)
+        this->renderWindow_->setActive(true);
+
+        // render
+        ogreRoot_->_updateAllRenderTargets();
+
+        // again, just to be sure OGRE works fine
+        ogreRoot_->_fireFrameEnded(evt); // note: uses the same time as _fireFrameStarted
     }
 
@@ -248,10 +240,10 @@
         // create a new logManager
         // Ogre::Root will detect that we've already created a Log
-        ogreLogger_ = new Ogre::LogManager();
+        std::auto_ptr<Ogre::LogManager> logger(new Ogre::LogManager());
         COUT(4) << "Ogre LogManager created" << std::endl;
 
         // create our own log that we can listen to
         Ogre::Log *myLog;
-        myLog = ogreLogger_->createLog(ogreLogFilepath.string(), true, false, false);
+        myLog = logger->createLog(ogreLogFilepath.string(), true, false, false);
         COUT(4) << "Ogre Log created" << std::endl;
 
@@ -272,4 +264,6 @@
         // Leave plugins file empty. We're going to do that part manually later
         ogreRoot_ = new Ogre::Root("", ogreConfigFilepath.string(), ogreLogFilepath.string());
+        // In case that new Root failed the logger gets destroyed because of the std::auto_ptr
+        ogreLogger_ = logger.release();
 
         COUT(3) << "Ogre set up done." << std::endl;
@@ -348,5 +342,5 @@
         if (!ogreRoot_->restoreConfig())
             if (!ogreRoot_->showConfigDialog())
-                ThrowException(InitialisationFailed, "Could not show Ogre configuration dialogue.");
+                ThrowException(InitialisationFailed, "OGRE graphics configuration dialogue failed.");
 
         CCOUT(4) << "Creating render window" << std::endl;
@@ -354,5 +348,4 @@
         this->renderWindow_ = ogreRoot_->initialise(true, "Orxonox");
 
-        this->ogreWindowEventListener_ = new OgreWindowEventListener();
         Ogre::WindowEventUtilities::addWindowEventListener(this->renderWindow_, ogreWindowEventListener_);
 
Index: code/trunk/src/orxonox/GraphicsManager.h
===================================================================
--- code/trunk/src/orxonox/GraphicsManager.h	(revision 3279)
+++ code/trunk/src/orxonox/GraphicsManager.h	(revision 3280)
@@ -57,5 +57,4 @@
 
         void setConfigValues();
-        void initialise();
 
         void update(const Clock& time);
@@ -93,11 +92,9 @@
 
     private:
-        bool                loaded_;
-
         Ogre::Root*         ogreRoot_;                 //!< Ogre's root
         Ogre::LogManager*   ogreLogger_;
         Ogre::RenderWindow* renderWindow_;             //!< the one and only render window
         Ogre::Viewport*     viewport_;                 //!< default full size viewport
-        OgreWindowEventListener* ogreWindowEventListener_;
+        OgreWindowEventListener* ogreWindowEventListener_; //!< Pimpl to hide OgreWindowUtilities.h
 
         // config values
Index: code/trunk/src/orxonox/LevelManager.cc
===================================================================
--- code/trunk/src/orxonox/LevelManager.cc	(revision 3279)
+++ code/trunk/src/orxonox/LevelManager.cc	(revision 3280)
@@ -30,4 +30,8 @@
 
 #include <map>
+
+#include "core/CommandLine.h"
+#include "core/ConfigValueIncludes.h"
+#include "core/CoreIncludes.h"
 #include "PlayerManager.h"
 #include "objects/Level.h"
@@ -36,4 +40,6 @@
 namespace orxonox
 {
+    SetCommandLineArgument(level, "").shortcut("l").information("Default level file (overrides LevelManager::defaultLevelName_ configValue)");
+
     LevelManager* LevelManager::singletonRef_s = 0;
 
@@ -42,4 +48,13 @@
         assert(singletonRef_s == 0);
         singletonRef_s = this;
+
+        RegisterRootObject(LevelManager);
+        this->setConfigValues();
+
+        // check override
+        if (!CommandLine::getArgument("level")->hasDefaultValue())
+        {
+            ModifyConfigValue(defaultLevelName_, tset, CommandLine::getValue("level").getString());
+        }
     }
 
@@ -48,4 +63,10 @@
         assert(singletonRef_s != 0);
         singletonRef_s = 0;
+    }
+
+    void LevelManager::setConfigValues()
+    {
+        SetConfigValue(defaultLevelName_, "presentation_dm.oxw")
+            .description("Sets the preselection of the level in the main menu.");
     }
 
@@ -93,3 +114,13 @@
         }
     }
+
+    void LevelManager::setDefaultLevel(const std::string& levelName)
+    {
+        ModifyConfigValue(defaultLevelName_, set, levelName);
+    }
+
+    const std::string& LevelManager::getDefaultLevel()
+    {
+        return defaultLevelName_;
+    }
 }
Index: code/trunk/src/orxonox/LevelManager.h
===================================================================
--- code/trunk/src/orxonox/LevelManager.h	(revision 3279)
+++ code/trunk/src/orxonox/LevelManager.h	(revision 3280)
@@ -34,12 +34,18 @@
 #include <cassert>
 #include <list>
+#include "core/OrxonoxClass.h"
 
+// tolua_begin
 namespace orxonox
 {
     class _OrxonoxExport LevelManager
-    {
+    // tolua_end
+        : public OrxonoxClass
+    { // tolua_export
         public:
             LevelManager();
             virtual ~LevelManager();
+
+            void setConfigValues();
 
             void requestActivity(Level* level);
@@ -47,6 +53,9 @@
             Level* getActiveLevel();
 
+            void setDefaultLevel(const std::string& levelName); //tolua_export
+            const std::string& getDefaultLevel(); //tolua_export
+
             static LevelManager* getInstancePtr() { return singletonRef_s; }
-            static LevelManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; }
+            static LevelManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; } // tolua_export
 
         private:
@@ -57,7 +66,10 @@
             std::list<Level*> levels_s;
 
+            // config values
+            std::string defaultLevelName_;
+
             static LevelManager* singletonRef_s;
-    };
-}
+    }; // tolua_export
+} // tolua_export
 
 #endif /* _LevelManager_H__ */
Index: code/trunk/src/orxonox/Main.cc
===================================================================
--- code/trunk/src/orxonox/Main.cc	(revision 3279)
+++ code/trunk/src/orxonox/Main.cc	(revision 3280)
@@ -37,5 +37,5 @@
 
 #include "util/Debug.h"
-#include "core/Identifier.h"
+#include "util/Exception.h"
 #include "core/Game.h"
 
@@ -50,8 +50,12 @@
 #endif
 {
+    using namespace orxonox;
+
+    Game* game = 0;
+    try
     {
-        orxonox::Game orxonox(argc, argv);
+        game = new Game(argc, argv);
 
-        orxonox.setStateHierarchy(
+        game->setStateHierarchy(
         "root"
         " graphics"
@@ -68,13 +72,21 @@
         );
 
-        orxonox.run();
+        game->requestState("root");
+    }
+    catch (const std::exception& ex)
+    {
+        COUT(0) << "Orxonox failed to initialise: " << ex.what() << std::endl;
+        COUT(0) << "Terminating program." << std::endl;
+        return 1;
+    }
+    catch (...)
+    {
+        COUT(0) << "Orxonox failed to initialise: " << std::endl;
+        COUT(0) << "Terminating program." << std::endl;
+        return 1;
+    }
 
-        // destroy the GameStates created pre-mainly
-        orxonox::Game::destroyStates();
-    } // orxonox gets destroyed right here!
-
-    // Clean up class hierarchy stuff (identifiers, xmlport, configvalue, consolecommand)
-    // Needs to be done after Game destructor because of ~OrxonoxClass
-    orxonox::Identifier::destroyAllIdentifiers();
+    game->run();
+    delete game;
 
     return 0;
Index: code/trunk/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- code/trunk/src/orxonox/OrxonoxPrereqs.h	(revision 3279)
+++ code/trunk/src/orxonox/OrxonoxPrereqs.h	(revision 3280)
@@ -65,10 +65,10 @@
     namespace LODParticle
     {
-        enum LOD
+        enum Value
         {
-            off = 0,
-            low = 1,
-            normal = 2,
-            high = 3
+            Off = 0,
+            Low = 1,
+            Normal = 2,
+            High = 3
         };
     }
@@ -295,4 +295,5 @@
 {
     class DefaultLogger;
+    class Logger;
     class LuaScriptModule;
 
Index: code/trunk/src/orxonox/gamestates/GSClient.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSClient.cc	(revision 3279)
+++ code/trunk/src/orxonox/gamestates/GSClient.cc	(revision 3280)
@@ -38,10 +38,10 @@
 namespace orxonox
 {
-    AddGameState(GSClient, "client");
+    DeclareGameState(GSClient, "client", false, true);
 
-    SetCommandLineArgument(ip, "127.0.0.1").information("#.#.#.#");
+    SetCommandLineArgument(ip, "127.0.0.1").information("Sever IP as strin in the form #.#.#.#");
 
-    GSClient::GSClient(const std::string& name)
-        : GameState(name)
+    GSClient::GSClient(const GameStateConstrParams& params)
+        : GameState(params)
         , client_(0)
     {
Index: code/trunk/src/orxonox/gamestates/GSClient.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSClient.h	(revision 3279)
+++ code/trunk/src/orxonox/gamestates/GSClient.h	(revision 3280)
@@ -40,5 +40,5 @@
     {
     public:
-        GSClient(const std::string& name);
+        GSClient(const GameStateConstrParams& params);
         ~GSClient();
 
Index: code/trunk/src/orxonox/gamestates/GSDedicated.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSDedicated.cc	(revision 3279)
+++ code/trunk/src/orxonox/gamestates/GSDedicated.cc	(revision 3280)
@@ -51,10 +51,10 @@
     const unsigned int MAX_COMMAND_LENGTH = 255;
     
-    AddGameState(GSDedicated, "dedicated");
+    DeclareGameState(GSDedicated, "dedicated", false, false);
     
     termios* GSDedicated::originalTerminalSettings_;
 
-    GSDedicated::GSDedicated(const std::string& name)
-        : GameState(name)
+    GSDedicated::GSDedicated(const GameStateConstrParams& params)
+        : GameState(params)
         , server_(0)
         , timeSinceLastUpdate_(0)
Index: code/trunk/src/orxonox/gamestates/GSDedicated.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSDedicated.h	(revision 3279)
+++ code/trunk/src/orxonox/gamestates/GSDedicated.h	(revision 3280)
@@ -48,5 +48,5 @@
     {
     public:
-        GSDedicated(const std::string& name);
+        GSDedicated(const GameStateConstrParams& params);
         ~GSDedicated();
 
Index: code/trunk/src/orxonox/gamestates/GSGraphics.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSGraphics.cc	(revision 3279)
+++ code/trunk/src/orxonox/gamestates/GSGraphics.cc	(revision 3280)
@@ -57,8 +57,8 @@
 namespace orxonox
 {
-    AddGameState(GSGraphics, "graphics", false);
-
-    GSGraphics::GSGraphics(const std::string& name, bool countTickTime)
-        : GameState(name, countTickTime)
+    DeclareGameState(GSGraphics, "graphics", true, true);
+
+    GSGraphics::GSGraphics(const GameStateConstrParams& params)
+        : GameState(params)
         , inputManager_(0)
         , console_(0)
@@ -108,7 +108,6 @@
         setConfigValues();
 
-        // initialise graphics manager. Doesn't load the render window yet!
+        // Load OGRE including the render window
         this->graphicsManager_ = new GraphicsManager();
-        this->graphicsManager_->initialise();
 
         // load debug overlay
@@ -198,5 +197,5 @@
     void GSGraphics::toggleGUI()
     {
-            GUIManager::getInstance().executeCode("toggleGUI()");
+        GUIManager::getInstance().executeCode("toggleGUI()");
     }
 
Index: code/trunk/src/orxonox/gamestates/GSGraphics.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSGraphics.h	(revision 3279)
+++ code/trunk/src/orxonox/gamestates/GSGraphics.h	(revision 3280)
@@ -52,5 +52,5 @@
     {
     public:
-        GSGraphics(const std::string& name, bool countTickTime);
+        GSGraphics(const GameStateConstrParams& params);
         ~GSGraphics();
         void setConfigValues();
Index: code/trunk/src/orxonox/gamestates/GSIOConsole.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSIOConsole.cc	(revision 3279)
+++ code/trunk/src/orxonox/gamestates/GSIOConsole.cc	(revision 3280)
@@ -36,8 +36,8 @@
 namespace orxonox
 {
-    AddGameState(GSIOConsole, "ioConsole");
+    DeclareGameState(GSIOConsole, "ioConsole", false, false);
 
-    GSIOConsole::GSIOConsole(const std::string& name)
-        : GameState(name)
+    GSIOConsole::GSIOConsole(const GameStateConstrParams& params)
+        : GameState(params)
     {
     }
Index: code/trunk/src/orxonox/gamestates/GSIOConsole.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSIOConsole.h	(revision 3279)
+++ code/trunk/src/orxonox/gamestates/GSIOConsole.h	(revision 3280)
@@ -38,5 +38,5 @@
     {
     public:
-        GSIOConsole(const std::string& name);
+        GSIOConsole(const GameStateConstrParams& params);
         ~GSIOConsole();
 
Index: code/trunk/src/orxonox/gamestates/GSLevel.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSLevel.cc	(revision 3279)
+++ code/trunk/src/orxonox/gamestates/GSLevel.cc	(revision 3280)
@@ -34,5 +34,4 @@
 #include "core/input/KeyBinder.h"
 #include "core/Clock.h"
-#include "core/CommandLine.h"
 #include "core/ConsoleCommand.h"
 #include "core/ConfigValueIncludes.h"
@@ -56,13 +55,11 @@
 namespace orxonox
 {
-    AddGameState(GSLevel, "level");
-
-    SetCommandLineArgument(level, "").shortcut("l");
+    DeclareGameState(GSLevel, "level", false, true);
     SetConsoleCommand(GSLevel, showIngameGUI, true);
 
     XMLFile* GSLevel::startFile_s = NULL;
 
-    GSLevel::GSLevel(const std::string& name)
-        : GameState(name)
+    GSLevel::GSLevel(const GameStateConstrParams& params)
+        : GameState(params)
         , keyBinder_(0)
         , gameInputState_(0)
@@ -71,5 +68,4 @@
         , radar_(0)
         , cameraManager_(0)
-        , levelManager_(0)
     {
         RegisterObject(GSLevel);
@@ -120,7 +116,4 @@
         if (GameMode::isMaster())
         {
-            // create the global LevelManager
-            this->levelManager_ = new LevelManager();
-
             this->loadLevel();
         }
@@ -202,10 +195,4 @@
         }
 
-        if (this->levelManager_)
-        {
-            delete this->levelManager_;
-            this->levelManager_ = 0;
-        }
-
         if (this->playerManager_)
         {
@@ -252,10 +239,5 @@
         // call the loader
         COUT(0) << "Loading level..." << std::endl;
-        std::string levelName;
-        CommandLine::getValue("level", &levelName);
-        if (levelName == "")
-            startFile_s = new XMLFile(Core::getMediaPathString() + "levels" + '/' + Game::getInstance().getLevel());
-        else
-            startFile_s = new XMLFile(Core::getMediaPathString() + "levels" + '/' + levelName);
+        startFile_s = new XMLFile(Core::getMediaPathString() + "levels" + '/' + LevelManager::getInstance().getDefaultLevel());
         Loader::open(startFile_s);
     }
Index: code/trunk/src/orxonox/gamestates/GSLevel.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSLevel.h	(revision 3279)
+++ code/trunk/src/orxonox/gamestates/GSLevel.h	(revision 3280)
@@ -41,5 +41,5 @@
     {
     public:
-        GSLevel(const std::string& name);
+        GSLevel(const GameStateConstrParams& params);
         ~GSLevel();
         void setConfigValues();
@@ -68,5 +68,4 @@
         Radar*                radar_;                   //!< represents the Radar (not the HUD part)
         CameraManager*        cameraManager_;           //!< camera manager for this level
-        LevelManager*         levelManager_;            //!< global level manager
         PlayerManager*        playerManager_;           //!< player manager for this level
         QuestManager*         questManager_;
Index: code/trunk/src/orxonox/gamestates/GSMainMenu.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSMainMenu.cc	(revision 3279)
+++ code/trunk/src/orxonox/gamestates/GSMainMenu.cc	(revision 3280)
@@ -43,8 +43,8 @@
 namespace orxonox
 {
-    AddGameState(GSMainMenu, "mainMenu");
+    DeclareGameState(GSMainMenu, "mainMenu", false, true);
 
-    GSMainMenu::GSMainMenu(const std::string& name)
-        : GameState(name)
+    GSMainMenu::GSMainMenu(const GameStateConstrParams& params)
+        : GameState(params)
         , inputState_(0)
     {
@@ -67,5 +67,5 @@
 
         // show main menu
-        GUIManager::getInstance().showGUI("mainmenu_2");
+        GUIManager::getInstance().showGUI("mainmenu_3");
         GUIManager::getInstance().setCamera(this->camera_);
         GraphicsManager::getInstance().setCamera(this->camera_);
Index: code/trunk/src/orxonox/gamestates/GSMainMenu.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSMainMenu.h	(revision 3279)
+++ code/trunk/src/orxonox/gamestates/GSMainMenu.h	(revision 3280)
@@ -40,5 +40,5 @@
     {
     public:
-        GSMainMenu(const std::string& name);
+        GSMainMenu(const GameStateConstrParams& params);
         ~GSMainMenu();
 
Index: code/trunk/src/orxonox/gamestates/GSRoot.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSRoot.cc	(revision 3279)
+++ code/trunk/src/orxonox/gamestates/GSRoot.cc	(revision 3280)
@@ -37,17 +37,18 @@
 #include "interfaces/TimeFactorListener.h"
 #include "interfaces/Tickable.h"
+#include "LevelManager.h"
 
 namespace orxonox
 {
-    AddGameState(GSRoot, "root", false);
-    SetCommandLineSwitch(console);
+    DeclareGameState(GSRoot, "root", true, false);
+    SetCommandLineSwitch(console).information("Start in console mode (text IO only)");
     // Shortcuts for easy direct loading
-    SetCommandLineSwitch(server);
-    SetCommandLineSwitch(client);
-    SetCommandLineSwitch(dedicated);
-    SetCommandLineSwitch(standalone);
-
-    GSRoot::GSRoot(const std::string& name, bool countTickTime)
-        : GameState(name, countTickTime)
+    SetCommandLineSwitch(server).information("Start in server mode");
+    SetCommandLineSwitch(client).information("Start in client mode");
+    SetCommandLineSwitch(dedicated).information("Start in dedicated server mode");
+    SetCommandLineSwitch(standalone).information("Start in standalone mode");
+
+    GSRoot::GSRoot(const GameStateConstrParams& params)
+        : GameState(params)
         , timeFactor_(1.0f)
         , bPaused_(false)
@@ -83,4 +84,7 @@
         }
 
+        // create the global LevelManager
+        this->levelManager_ = new LevelManager();
+
         // Load level directly?
         bool loadLevel = false;
@@ -129,4 +133,6 @@
         }
 */
+
+        delete this->levelManager_;
     }
 
Index: code/trunk/src/orxonox/gamestates/GSRoot.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSRoot.h	(revision 3279)
+++ code/trunk/src/orxonox/gamestates/GSRoot.h	(revision 3280)
@@ -38,5 +38,5 @@
     {
     public:
-        GSRoot(const std::string& name, bool countTickTime);
+        GSRoot(const GameStateConstrParams& params);
         ~GSRoot();
 
@@ -52,7 +52,9 @@
 
     private:
-        float                 timeFactor_;       //!< A factor that sets the gamespeed. 1 is normal.
+        float                 timeFactor_;              //!< A factor that sets the gamespeed. 1 is normal.
         bool                  bPaused_;
         float                 timeFactorPauseBackup_;
+
+        LevelManager*         levelManager_;            //!< global level manager
 
         // console commands
Index: code/trunk/src/orxonox/gamestates/GSServer.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSServer.cc	(revision 3279)
+++ code/trunk/src/orxonox/gamestates/GSServer.cc	(revision 3280)
@@ -37,10 +37,10 @@
 namespace orxonox
 {
-    AddGameState(GSServer, "server");
+    DeclareGameState(GSServer, "server", false, true);
 
-    SetCommandLineArgument(port, 55556).shortcut("p").information("0-65535");
+    SetCommandLineArgument(port, 55556).shortcut("p").information("Network communication port to be used 0-65535 (default: 55556)");
 
-    GSServer::GSServer(const std::string& name)
-        : GameState(name)
+    GSServer::GSServer(const GameStateConstrParams& params)
+        : GameState(params)
         , server_(0)
     {
Index: code/trunk/src/orxonox/gamestates/GSServer.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSServer.h	(revision 3279)
+++ code/trunk/src/orxonox/gamestates/GSServer.h	(revision 3280)
@@ -40,5 +40,5 @@
     {
     public:
-        GSServer(const std::string& name);
+        GSServer(const GameStateConstrParams& params);
         ~GSServer();
 
Index: code/trunk/src/orxonox/gamestates/GSStandalone.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSStandalone.cc	(revision 3279)
+++ code/trunk/src/orxonox/gamestates/GSStandalone.cc	(revision 3280)
@@ -34,8 +34,8 @@
 namespace orxonox
 {
-    AddGameState(GSStandalone, "standalone");
+    DeclareGameState(GSStandalone, "standalone", false, true);
 
-    GSStandalone::GSStandalone(const std::string& name)
-        : GameState(name)
+    GSStandalone::GSStandalone(const GameStateConstrParams& params)
+        : GameState(params)
     {
     }
Index: code/trunk/src/orxonox/gamestates/GSStandalone.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSStandalone.h	(revision 3279)
+++ code/trunk/src/orxonox/gamestates/GSStandalone.h	(revision 3280)
@@ -38,5 +38,5 @@
     {
     public:
-        GSStandalone(const std::string& name);
+        GSStandalone(const GameStateConstrParams& params);
         ~GSStandalone();
 
Index: code/trunk/src/orxonox/gui/GUIManager.cc
===================================================================
--- code/trunk/src/orxonox/gui/GUIManager.cc	(revision 3279)
+++ code/trunk/src/orxonox/gui/GUIManager.cc	(revision 3280)
@@ -53,5 +53,7 @@
 #endif
 
+#include "util/Debug.h"
 #include "util/Exception.h"
+#include "util/OrxAssert.h"
 #include "core/Core.h"
 #include "core/Clock.h"
@@ -62,4 +64,26 @@
 namespace orxonox
 {
+    class CEGUILogger : public CEGUI::DefaultLogger
+    {
+    public:
+	    void logEvent(const CEGUI::String& message, CEGUI::LoggingLevel level = CEGUI::Standard)
+        {
+            int orxonoxLevel;
+            switch (level)
+            {
+                case CEGUI::Errors:      orxonoxLevel = 1; break;
+                case CEGUI::Warnings:    orxonoxLevel = 2; break;
+                case CEGUI::Standard:    orxonoxLevel = 4; break;
+                case CEGUI::Informative: orxonoxLevel = 5; break;
+                case CEGUI::Insane:      orxonoxLevel = 6; break;
+                default: OrxAssert(false, "CEGUI log level out of range, inpect immediately!");
+            }
+            OutputHandler::getOutStream().setOutputLevel(orxonoxLevel)
+                << "CEGUI: " << message << std::endl;
+
+            CEGUI::DefaultLogger::logEvent(message, level);
+        }
+    };
+
     static CEGUI::MouseButton convertButton(MouseButtonCode::ByEnum button);
     GUIManager* GUIManager::singletonRef_s = 0;
@@ -140,5 +164,5 @@
 
                 // Create our own logger to specify the filepath
-                this->ceguiLogger_ = new DefaultLogger();
+                this->ceguiLogger_ = new CEGUILogger();
                 this->ceguiLogger_->setLogFilename(Core::getLogPathString() + "cegui.log");
                 // set the log level according to ours (translate by subtracting 1)
Index: code/trunk/src/orxonox/gui/GUIManager.h
===================================================================
--- code/trunk/src/orxonox/gui/GUIManager.h	(revision 3279)
+++ code/trunk/src/orxonox/gui/GUIManager.h	(revision 3280)
@@ -123,5 +123,5 @@
         CEGUI::ResourceProvider*    resourceProvider_;  //!< CEGUI's resource provider
         CEGUI::LuaScriptModule*     scriptModule_;      //!< CEGUI's script module to use Lua
-        CEGUI::DefaultLogger*       ceguiLogger_;       //!< CEGUI's logger to be able to log CEGUI errors in our log
+        CEGUI::Logger*              ceguiLogger_;       //!< CEGUI's logger to be able to log CEGUI errors in our log
         CEGUI::System*              guiSystem_;         //!< CEGUI's main system
         lua_State*                  luaState_;          //!< Lua state, access point to the Lua engine
Index: code/trunk/src/orxonox/interfaces/RadarViewable.cc
===================================================================
--- code/trunk/src/orxonox/interfaces/RadarViewable.cc	(revision 3279)
+++ code/trunk/src/orxonox/interfaces/RadarViewable.cc	(revision 3280)
@@ -33,5 +33,5 @@
 #include <OgreEntity.h>
 
-#include "util/String.h"
+#include "util/StringUtils.h"
 #include "core/CoreIncludes.h"
 #include "tools/DynamicLines.h"
Index: code/trunk/src/orxonox/objects/GlobalShader.cc
===================================================================
--- code/trunk/src/orxonox/objects/GlobalShader.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/GlobalShader.cc	(revision 3280)
@@ -66,6 +66,6 @@
     void GlobalShader::registerVariables()
     {
-        registerVariable(this->bVisible_,                                         variableDirection::toclient, new NetworkCallback<GlobalShader>(this, &GlobalShader::changedVisibility));
-        registerVariable(const_cast<std::string&>(this->shader_.getCompositor()), variableDirection::toclient, new NetworkCallback<Shader>(&this->shader_, &Shader::changedCompositor));
+        registerVariable(this->bVisible_,                                         VariableDirection::ToClient, new NetworkCallback<GlobalShader>(this, &GlobalShader::changedVisibility));
+        registerVariable(const_cast<std::string&>(this->shader_.getCompositor()), VariableDirection::ToClient, new NetworkCallback<Shader>(&this->shader_, &Shader::changedCompositor));
     }
 
Index: code/trunk/src/orxonox/objects/Level.cc
===================================================================
--- code/trunk/src/orxonox/objects/Level.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/Level.cc	(revision 3280)
@@ -87,7 +87,7 @@
     void Level::registerVariables()
     {
-        registerVariable(this->xmlfilename_, variableDirection::toclient, new NetworkCallback<Level>(this, &Level::networkcallback_applyXMLFile));
-        registerVariable(this->name_,        variableDirection::toclient, new NetworkCallback<Level>(this, &Level::changedName));
-        registerVariable(this->description_, variableDirection::toclient);
+        registerVariable(this->xmlfilename_, VariableDirection::ToClient, new NetworkCallback<Level>(this, &Level::networkcallback_applyXMLFile));
+        registerVariable(this->name_,        VariableDirection::ToClient, new NetworkCallback<Level>(this, &Level::changedName));
+        registerVariable(this->description_, VariableDirection::ToClient);
     }
 
Index: code/trunk/src/orxonox/objects/Scene.cc
===================================================================
--- code/trunk/src/orxonox/objects/Scene.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/Scene.cc	(revision 3280)
@@ -115,11 +115,11 @@
     void Scene::registerVariables()
     {
-        registerVariable(this->skybox_,             variableDirection::toclient, new NetworkCallback<Scene>(this, &Scene::networkcallback_applySkybox));
-        registerVariable(this->ambientLight_,       variableDirection::toclient, new NetworkCallback<Scene>(this, &Scene::networkcallback_applyAmbientLight));
-        registerVariable(this->negativeWorldRange_, variableDirection::toclient, new NetworkCallback<Scene>(this, &Scene::networkcallback_negativeWorldRange));
-        registerVariable(this->positiveWorldRange_, variableDirection::toclient, new NetworkCallback<Scene>(this, &Scene::networkcallback_positiveWorldRange));
-        registerVariable(this->gravity_,            variableDirection::toclient, new NetworkCallback<Scene>(this, &Scene::networkcallback_gravity));
-        registerVariable(this->bHasPhysics_,        variableDirection::toclient, new NetworkCallback<Scene>(this, &Scene::networkcallback_hasPhysics));
-        registerVariable(this->bShadows_,           variableDirection::toclient, new NetworkCallback<Scene>(this, &Scene::networkcallback_applyShadows));
+        registerVariable(this->skybox_,             VariableDirection::ToClient, new NetworkCallback<Scene>(this, &Scene::networkcallback_applySkybox));
+        registerVariable(this->ambientLight_,       VariableDirection::ToClient, new NetworkCallback<Scene>(this, &Scene::networkcallback_applyAmbientLight));
+        registerVariable(this->negativeWorldRange_, VariableDirection::ToClient, new NetworkCallback<Scene>(this, &Scene::networkcallback_negativeWorldRange));
+        registerVariable(this->positiveWorldRange_, VariableDirection::ToClient, new NetworkCallback<Scene>(this, &Scene::networkcallback_positiveWorldRange));
+        registerVariable(this->gravity_,            VariableDirection::ToClient, new NetworkCallback<Scene>(this, &Scene::networkcallback_gravity));
+        registerVariable(this->bHasPhysics_,        VariableDirection::ToClient, new NetworkCallback<Scene>(this, &Scene::networkcallback_hasPhysics));
+        registerVariable(this->bShadows_,           VariableDirection::ToClient, new NetworkCallback<Scene>(this, &Scene::networkcallback_applyShadows));
     }
 
Index: code/trunk/src/orxonox/objects/collisionshapes/BoxCollisionShape.cc
===================================================================
--- code/trunk/src/orxonox/objects/collisionshapes/BoxCollisionShape.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/collisionshapes/BoxCollisionShape.cc	(revision 3280)
@@ -57,5 +57,5 @@
     void BoxCollisionShape::registerVariables()
     {
-        registerVariable(this->halfExtents_, variableDirection::toclient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
+        registerVariable(this->halfExtents_, VariableDirection::ToClient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
     }
 
Index: code/trunk/src/orxonox/objects/collisionshapes/CollisionShape.cc
===================================================================
--- code/trunk/src/orxonox/objects/collisionshapes/CollisionShape.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/collisionshapes/CollisionShape.cc	(revision 3280)
@@ -77,5 +77,5 @@
     void CollisionShape::registerVariables()
     {
-        registerVariable(this->parentID_, variableDirection::toclient, new NetworkCallback<CollisionShape>(this, &CollisionShape::parentChanged));
+        registerVariable(this->parentID_, VariableDirection::ToClient, new NetworkCallback<CollisionShape>(this, &CollisionShape::parentChanged));
     }
 
Index: code/trunk/src/orxonox/objects/collisionshapes/ConeCollisionShape.cc
===================================================================
--- code/trunk/src/orxonox/objects/collisionshapes/ConeCollisionShape.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/collisionshapes/ConeCollisionShape.cc	(revision 3280)
@@ -57,6 +57,6 @@
     void ConeCollisionShape::registerVariables()
     {
-        registerVariable(this->radius_, variableDirection::toclient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
-        registerVariable(this->height_, variableDirection::toclient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
+        registerVariable(this->radius_, VariableDirection::ToClient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
+        registerVariable(this->height_, VariableDirection::ToClient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
     }
 
Index: code/trunk/src/orxonox/objects/collisionshapes/PlaneCollisionShape.cc
===================================================================
--- code/trunk/src/orxonox/objects/collisionshapes/PlaneCollisionShape.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/collisionshapes/PlaneCollisionShape.cc	(revision 3280)
@@ -58,6 +58,6 @@
     void PlaneCollisionShape::registerVariables()
     {
-        registerVariable(this->normal_, variableDirection::toclient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
-        registerVariable(this->offset_, variableDirection::toclient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
+        registerVariable(this->normal_, VariableDirection::ToClient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
+        registerVariable(this->offset_, VariableDirection::ToClient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
     }
 
Index: code/trunk/src/orxonox/objects/collisionshapes/SphereCollisionShape.cc
===================================================================
--- code/trunk/src/orxonox/objects/collisionshapes/SphereCollisionShape.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/collisionshapes/SphereCollisionShape.cc	(revision 3280)
@@ -56,5 +56,5 @@
     void SphereCollisionShape::registerVariables()
     {
-        registerVariable(this->radius_, variableDirection::toclient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
+        registerVariable(this->radius_, VariableDirection::ToClient, new NetworkCallback<CollisionShape>(this, &CollisionShape::updateShape));
     }
 
Index: code/trunk/src/orxonox/objects/controllers/ArtificialController.cc
===================================================================
--- code/trunk/src/orxonox/objects/controllers/ArtificialController.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/controllers/ArtificialController.cc	(revision 3280)
@@ -208,11 +208,11 @@
             switch (base->getState())
             {
-                case BaseState::controlTeam1:
+                case BaseState::ControlTeam1:
                     team1 = 0;
                     break;
-                case BaseState::controlTeam2:
+                case BaseState::ControlTeam2:
                     team1 = 1;
                     break;
-                case BaseState::uncontrolled:
+                case BaseState::Uncontrolled:
                 default:
                     team1 = -1;
@@ -224,11 +224,11 @@
             switch (base->getState())
             {
-                case BaseState::controlTeam1:
+                case BaseState::ControlTeam1:
                     team2 = 0;
                     break;
-                case BaseState::controlTeam2:
+                case BaseState::ControlTeam2:
                     team2 = 1;
                     break;
-                case BaseState::uncontrolled:
+                case BaseState::Uncontrolled:
                 default:
                     team2 = -1;
Index: code/trunk/src/orxonox/objects/gametypes/Gametype.h
===================================================================
--- code/trunk/src/orxonox/objects/gametypes/Gametype.h	(revision 3279)
+++ code/trunk/src/orxonox/objects/gametypes/Gametype.h	(revision 3280)
@@ -45,5 +45,5 @@
     namespace PlayerState
     {
-        enum Enum
+        enum Value
         {
             Uninitialized,
@@ -57,5 +57,5 @@
     {
         PlayerInfo* info_;
-        PlayerState::Enum state_;
+        PlayerState::Value state_;
         int frags_;
         int killed_;
Index: code/trunk/src/orxonox/objects/gametypes/TeamBaseMatch.cc
===================================================================
--- code/trunk/src/orxonox/objects/gametypes/TeamBaseMatch.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/gametypes/TeamBaseMatch.cc	(revision 3280)
@@ -66,10 +66,10 @@
                 if (teamnr == 0)
                 {
-                    base->setState(BaseState::controlTeam1);
+                    base->setState(BaseState::ControlTeam1);
                     this->gtinfo_.sendAnnounceMessage("The red team captured a base");
                 }
                 if (teamnr == 1)
                 {
-                    base->setState(BaseState::controlTeam2);
+                    base->setState(BaseState::ControlTeam2);
                     this->gtinfo_.sendAnnounceMessage("The blue team captured a base");
                 }
@@ -107,11 +107,11 @@
             switch (base->getState())
             {
-                case BaseState::controlTeam1:
+                case BaseState::ControlTeam1:
                     teamnrbase = 0;
                     break;
-                case BaseState::controlTeam2:
+                case BaseState::ControlTeam2:
                     teamnrbase = 1;
                     break;
-                case BaseState::uncontrolled:
+                case BaseState::Uncontrolled:
                 default:
                     teamnrbase = -1;
@@ -155,9 +155,9 @@
         for (std::set<TeamBaseMatchBase*>::const_iterator it = this->bases_.begin(); it != this->bases_.end(); ++it)
         {
-            if((*it)->getState() == BaseState::controlTeam1)
+            if((*it)->getState() == BaseState::ControlTeam1)
             {
                 amountControlled++;
             }
-            if((*it)->getState() == BaseState::controlTeam2)
+            if((*it)->getState() == BaseState::ControlTeam2)
             {
                 amountControlled2++;
@@ -241,7 +241,7 @@
         for (std::set<TeamBaseMatchBase*>::const_iterator it = this->bases_.begin(); it != this->bases_.end(); ++it)
         {
-            if ((*it)->getState() == BaseState::controlTeam1 && team == 0)
+            if ((*it)->getState() == BaseState::ControlTeam1 && team == 0)
                 count++;
-            if ((*it)->getState() == BaseState::controlTeam2 && team == 1)
+            if ((*it)->getState() == BaseState::ControlTeam2 && team == 1)
                 count++;
         }
@@ -253,5 +253,5 @@
     {
         this->bases_.insert(base);
-        base->setState(BaseState::uncontrolled);
+        base->setState(BaseState::Uncontrolled);
     }
 
Index: code/trunk/src/orxonox/objects/gametypes/UnderAttack.cc
===================================================================
--- code/trunk/src/orxonox/objects/gametypes/UnderAttack.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/gametypes/UnderAttack.cc	(revision 3280)
@@ -173,5 +173,5 @@
             if ( gameTime_ <= timesequence_ && gameTime_ > 0)
             {
-                std::string message = convertToString(timesequence_) + " seconds left!";
+                std::string message = multi_cast<std::string>(timesequence_) + " seconds left!";
 /*
                 COUT(0) << message << std::endl;
Index: code/trunk/src/orxonox/objects/infos/GametypeInfo.cc
===================================================================
--- code/trunk/src/orxonox/objects/infos/GametypeInfo.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/infos/GametypeInfo.cc	(revision 3280)
@@ -61,9 +61,9 @@
     void GametypeInfo::registerVariables()
     {
-        registerVariable(this->bStarted_,               variableDirection::toclient);
-        registerVariable(this->bEnded_,                 variableDirection::toclient);
-        registerVariable(this->startCountdown_,         variableDirection::toclient);
-        registerVariable(this->bStartCountdownRunning_, variableDirection::toclient);
-        registerVariable(this->hudtemplate_,            variableDirection::toclient);
+        registerVariable(this->bStarted_,               VariableDirection::ToClient);
+        registerVariable(this->bEnded_,                 VariableDirection::ToClient);
+        registerVariable(this->startCountdown_,         VariableDirection::ToClient);
+        registerVariable(this->bStartCountdownRunning_, VariableDirection::ToClient);
+        registerVariable(this->hudtemplate_,            VariableDirection::ToClient);
     }
 
Index: code/trunk/src/orxonox/objects/infos/HumanPlayer.cc
===================================================================
--- code/trunk/src/orxonox/objects/infos/HumanPlayer.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/infos/HumanPlayer.cc	(revision 3280)
@@ -79,9 +79,9 @@
     void HumanPlayer::registerVariables()
     {
-        registerVariable(this->synchronize_nick_, variableDirection::toserver, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_changednick));
+        registerVariable(this->synchronize_nick_, VariableDirection::ToServer, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_changednick));
 
-        registerVariable(this->clientID_,           variableDirection::toclient, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_clientIDchanged));
-        registerVariable(this->server_initialized_, variableDirection::toclient, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_server_initialized));
-        registerVariable(this->client_initialized_, variableDirection::toserver, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_client_initialized));
+        registerVariable(this->clientID_,           VariableDirection::ToClient, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_clientIDchanged));
+        registerVariable(this->server_initialized_, VariableDirection::ToClient, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_server_initialized));
+        registerVariable(this->client_initialized_, VariableDirection::ToServer, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_client_initialized));
     }
 
@@ -116,5 +116,5 @@
 
             if (!GameMode::isMaster())
-                this->setObjectMode(objectDirection::bidirectional);
+                this->setObjectMode(ObjectDirection::Bidirectional);
             else
                 this->setName(this->nick_);
Index: code/trunk/src/orxonox/objects/infos/PlayerInfo.cc
===================================================================
--- code/trunk/src/orxonox/objects/infos/PlayerInfo.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/infos/PlayerInfo.cc	(revision 3280)
@@ -77,8 +77,8 @@
     void PlayerInfo::registerVariables()
     {
-        registerVariable(this->name_,                 variableDirection::toclient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::changedName));
-        registerVariable(this->controllableEntityID_, variableDirection::toclient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::networkcallback_changedcontrollableentityID));
-        registerVariable(this->bReadyToSpawn_,        variableDirection::toserver);
-        registerVariable(this->gtinfoID_,             variableDirection::toclient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::networkcallback_changedgtinfoID));
+        registerVariable(this->name_,                 VariableDirection::ToClient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::changedName));
+        registerVariable(this->controllableEntityID_, VariableDirection::ToClient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::networkcallback_changedcontrollableentityID));
+        registerVariable(this->bReadyToSpawn_,        VariableDirection::ToServer);
+        registerVariable(this->gtinfoID_,             VariableDirection::ToClient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::networkcallback_changedgtinfoID));
     }
 
Index: code/trunk/src/orxonox/objects/items/Engine.cc
===================================================================
--- code/trunk/src/orxonox/objects/items/Engine.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/items/Engine.cc	(revision 3280)
@@ -113,19 +113,19 @@
     void Engine::registerVariables()
     {
-        registerVariable(this->shipID_, variableDirection::toclient, new NetworkCallback<Engine>(this, &Engine::networkcallback_shipID));
-
-        registerVariable(this->speedFactor_, variableDirection::toclient);
-        registerVariable(this->boostFactor_, variableDirection::toclient);
-
-        registerVariable(this->maxSpeedFront_,     variableDirection::toclient);
-        registerVariable(this->maxSpeedBack_,      variableDirection::toclient);
-        registerVariable(this->maxSpeedLeftRight_, variableDirection::toclient);
-        registerVariable(this->maxSpeedUpDown_,    variableDirection::toclient);
-
-        registerVariable(this->accelerationFront_,     variableDirection::toclient);
-        registerVariable(this->accelerationBrake_,     variableDirection::toclient);
-        registerVariable(this->accelerationBack_,      variableDirection::toclient);
-        registerVariable(this->accelerationLeftRight_, variableDirection::toclient);
-        registerVariable(this->accelerationUpDown_,    variableDirection::toclient);
+        registerVariable(this->shipID_, VariableDirection::ToClient, new NetworkCallback<Engine>(this, &Engine::networkcallback_shipID));
+
+        registerVariable(this->speedFactor_, VariableDirection::ToClient);
+        registerVariable(this->boostFactor_, VariableDirection::ToClient);
+
+        registerVariable(this->maxSpeedFront_,     VariableDirection::ToClient);
+        registerVariable(this->maxSpeedBack_,      VariableDirection::ToClient);
+        registerVariable(this->maxSpeedLeftRight_, VariableDirection::ToClient);
+        registerVariable(this->maxSpeedUpDown_,    VariableDirection::ToClient);
+
+        registerVariable(this->accelerationFront_,     VariableDirection::ToClient);
+        registerVariable(this->accelerationBrake_,     VariableDirection::ToClient);
+        registerVariable(this->accelerationBack_,      VariableDirection::ToClient);
+        registerVariable(this->accelerationLeftRight_, VariableDirection::ToClient);
+        registerVariable(this->accelerationUpDown_,    VariableDirection::ToClient);
     }
 
Index: code/trunk/src/orxonox/objects/items/MultiStateEngine.cc
===================================================================
--- code/trunk/src/orxonox/objects/items/MultiStateEngine.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/items/MultiStateEngine.cc	(revision 3280)
@@ -82,5 +82,5 @@
     void MultiStateEngine::registerVariables()
     {
-        registerVariable(this->state_, variableDirection::toserver);
+        registerVariable(this->state_, VariableDirection::ToServer);
     }
 
@@ -91,5 +91,5 @@
             if (this->getShip()->hasLocalController())
             {
-                this->setObjectMode(objectDirection::bidirectional);
+                this->setObjectMode(ObjectDirection::Bidirectional);
 
                 const Vector3& direction = this->getDirection();
Index: code/trunk/src/orxonox/objects/pickup/ModifierPickup.cc
===================================================================
--- code/trunk/src/orxonox/objects/pickup/ModifierPickup.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/pickup/ModifierPickup.cc	(revision 3280)
@@ -87,5 +87,5 @@
         if (this->addTo(pawn))
         {
-            std::map<ModifierType::Enum, float>::iterator it;
+            std::map<ModifierType::Value, float>::iterator it;
 
             for (it = this->additiveModifiers_.begin(); it != this->additiveModifiers_.end(); it++)
@@ -124,5 +124,5 @@
         if (this->removeFrom(pawn))
         {
-            std::map<ModifierType::Enum, float>::iterator it;
+            std::map<ModifierType::Value, float>::iterator it;
 
             for (it = this->additiveModifiers_.begin(); it != this->additiveModifiers_.end(); it++)
@@ -158,7 +158,7 @@
         @return Returns the additive modifier for type (or 0 if not exists).
     */
-    float ModifierPickup::getAdditiveModifier(ModifierType::Enum type) const
-    {
-        std::map<ModifierType::Enum, float>::const_iterator it = this->additiveModifiers_.find(type);
+    float ModifierPickup::getAdditiveModifier(ModifierType::Value type) const
+    {
+        std::map<ModifierType::Value, float>::const_iterator it = this->additiveModifiers_.find(type);
         if (it != this->additiveModifiers_.end())
             return (*it).second;
@@ -171,7 +171,7 @@
         @return Returns the multiplicative modifier for type (or 1 if not exists).
     */
-    float ModifierPickup::getMultiplicativeModifier(ModifierType::Enum type) const
-    {
-        std::map<ModifierType::Enum, float>::const_iterator it = this->multiplicativeModifiers_.find(type);
+    float ModifierPickup::getMultiplicativeModifier(ModifierType::Value type) const
+    {
+        std::map<ModifierType::Value, float>::const_iterator it = this->multiplicativeModifiers_.find(type);
         if (it != this->multiplicativeModifiers_.end())
             return (*it).second;
@@ -184,8 +184,8 @@
         @param value The new additive modifier for type.
     */
-    void ModifierPickup::setAdditiveModifier(ModifierType::Enum type, float value)
+    void ModifierPickup::setAdditiveModifier(ModifierType::Value type, float value)
     {
         if (this->additiveModifiers_.find(type) == this->additiveModifiers_.end())
-            this->additiveModifiers_.insert( std::pair<ModifierType::Enum, float>(type, value) );
+            this->additiveModifiers_.insert( std::pair<ModifierType::Value, float>(type, value) );
         else
             this->additiveModifiers_[type] = value;
@@ -196,8 +196,8 @@
         @param value The new multiplicative modifier for type.
     */
-    void ModifierPickup::setMultiplicativeModifier(ModifierType::Enum type, float value)
+    void ModifierPickup::setMultiplicativeModifier(ModifierType::Value type, float value)
     {
         if (this->multiplicativeModifiers_.find(type) == this->multiplicativeModifiers_.end())
-            this->multiplicativeModifiers_.insert( std::pair<ModifierType::Enum, float>(type, value) );
+            this->multiplicativeModifiers_.insert( std::pair<ModifierType::Value, float>(type, value) );
         else
             this->multiplicativeModifiers_[type] = value;
Index: code/trunk/src/orxonox/objects/pickup/ModifierPickup.h
===================================================================
--- code/trunk/src/orxonox/objects/pickup/ModifierPickup.h	(revision 3279)
+++ code/trunk/src/orxonox/objects/pickup/ModifierPickup.h	(revision 3280)
@@ -130,11 +130,11 @@
         void timerCallback(Pawn* pawn);     //!< Method called when the timer runs out.
     private:
-        float getAdditiveModifier(ModifierType::Enum type) const;               //!< Get the additive modifier for a given ModifierType.
-        float getMultiplicativeModifier(ModifierType::Enum type) const;         //!< Get the multiplicative modifier for a given ModifierType.
-        void setAdditiveModifier(ModifierType::Enum type, float value);         //!< Set the additive modifier for a given ModifierType.
-        void setMultiplicativeModifier(ModifierType::Enum type, float value);   //!< Set the multiplicative modifier for a given ModifierType
+        float getAdditiveModifier(ModifierType::Value type) const;               //!< Get the additive modifier for a given ModifierType.
+        float getMultiplicativeModifier(ModifierType::Value type) const;         //!< Get the multiplicative modifier for a given ModifierType.
+        void setAdditiveModifier(ModifierType::Value type, float value);         //!< Set the additive modifier for a given ModifierType.
+        void setMultiplicativeModifier(ModifierType::Value type, float value);   //!< Set the multiplicative modifier for a given ModifierType
 
-        std::map<ModifierType::Enum, float> additiveModifiers_;                 //!< Map of additive modifiers, indexed by ModifierType.
-        std::map<ModifierType::Enum, float> multiplicativeModifiers_;           //!< Map of multiplicative modifiers, indexed by ModifierType.
+        std::map<ModifierType::Value, float> additiveModifiers_;                 //!< Map of additive modifiers, indexed by ModifierType.
+        std::map<ModifierType::Value, float> multiplicativeModifiers_;           //!< Map of multiplicative modifiers, indexed by ModifierType.
 
         float duration_;                                                        //!< Duration of this pickup's effect (0 for unlimited).
Index: code/trunk/src/orxonox/objects/pickup/ModifierType.h
===================================================================
--- code/trunk/src/orxonox/objects/pickup/ModifierType.h	(revision 3279)
+++ code/trunk/src/orxonox/objects/pickup/ModifierType.h	(revision 3280)
@@ -44,5 +44,5 @@
             @brief Gives the available types for modifiers.
         */
-        enum Enum
+        enum Value
         {
             Unknown = 0,
Index: code/trunk/src/orxonox/objects/pickup/PickupCollection.cc
===================================================================
--- code/trunk/src/orxonox/objects/pickup/PickupCollection.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/pickup/PickupCollection.cc	(revision 3280)
@@ -42,5 +42,5 @@
 {
     typedef std::pair<std::multimap<std::string, BaseItem*>::iterator, std::multimap<std::string, BaseItem*>::iterator> item_range;
-    typedef std::pair<std::multimap<ModifierType::Enum, float>::iterator, std::multimap<ModifierType::Enum, float>::iterator> modifier_range;
+    typedef std::pair<std::multimap<ModifierType::Value, float>::iterator, std::multimap<ModifierType::Value, float>::iterator> modifier_range;
 
     //! Constructor
@@ -200,7 +200,7 @@
         @param value Value for the modifier.
     */
-    void PickupCollection::addAdditiveModifier(ModifierType::Enum type, float value)
-    {
-        this->additiveModifiers_.insert( std::pair<ModifierType::Enum, float>(type, value) );
+    void PickupCollection::addAdditiveModifier(ModifierType::Value type, float value)
+    {
+        this->additiveModifiers_.insert( std::pair<ModifierType::Value, float>(type, value) );
     }
     /**
@@ -209,5 +209,5 @@
         @return Returns the sum of the additive modifiers of the type.
     */
-    float PickupCollection::getAdditiveModifier(ModifierType::Enum type)
+    float PickupCollection::getAdditiveModifier(ModifierType::Value type)
     {
         float v = 0.0f;
@@ -215,5 +215,5 @@
         modifier_range range = this->additiveModifiers_.equal_range(type);
 
-        for (std::multimap<ModifierType::Enum, float>::iterator it = range.first; it != range.second && it != this->additiveModifiers_.end(); it++)
+        for (std::multimap<ModifierType::Value, float>::iterator it = range.first; it != range.second && it != this->additiveModifiers_.end(); it++)
         {
             v += (*it).second;
@@ -227,8 +227,8 @@
         @param value Value which is to be removed.
     */
-    void PickupCollection::removeAdditiveModifier(ModifierType::Enum type, float value)
+    void PickupCollection::removeAdditiveModifier(ModifierType::Value type, float value)
     {
         modifier_range range = this->additiveModifiers_.equal_range(type);
-        for (std::multimap<ModifierType::Enum, float>::iterator it = range.first; it != range.second && it != this->additiveModifiers_.end(); it++)
+        for (std::multimap<ModifierType::Value, float>::iterator it = range.first; it != range.second && it != this->additiveModifiers_.end(); it++)
         {
             if ((*it).second == value)
@@ -244,7 +244,7 @@
         @param value Value for the modifier.
     */
-    void PickupCollection::addMultiplicativeModifier(ModifierType::Enum type, float value)
-    {
-        this->multiplicativeModifiers_.insert( std::pair<ModifierType::Enum, float>(type, value) );
+    void PickupCollection::addMultiplicativeModifier(ModifierType::Value type, float value)
+    {
+        this->multiplicativeModifiers_.insert( std::pair<ModifierType::Value, float>(type, value) );
     }
     /**
@@ -253,10 +253,10 @@
         @return Returns the product of the multiplicative modifiers of the type.
     */
-    float PickupCollection::getMultiplicativeModifier(ModifierType::Enum type)
+    float PickupCollection::getMultiplicativeModifier(ModifierType::Value type)
     {
         float v = 1.0f;
 
         modifier_range range = this->multiplicativeModifiers_.equal_range(type);
-        for (std::multimap<ModifierType::Enum, float>::iterator it = range.first; it != range.second && it != this->multiplicativeModifiers_.end(); it++)
+        for (std::multimap<ModifierType::Value, float>::iterator it = range.first; it != range.second && it != this->multiplicativeModifiers_.end(); it++)
         {
             v *= (*it).second;
@@ -270,8 +270,8 @@
         @param value Value which is to be removed.
     */
-    void PickupCollection::removeMultiplicativeModifier(ModifierType::Enum type, float value)
+    void PickupCollection::removeMultiplicativeModifier(ModifierType::Value type, float value)
     {
         modifier_range range = this->multiplicativeModifiers_.equal_range(type);
-        for (std::multimap<ModifierType::Enum, float>::iterator it = range.first; it != range.second && it != this->multiplicativeModifiers_.end(); it++)
+        for (std::multimap<ModifierType::Value, float>::iterator it = range.first; it != range.second && it != this->multiplicativeModifiers_.end(); it++)
         {
             if ((*it).second == value)
@@ -289,5 +289,5 @@
         @return Returns the value after being processed.
     */
-    float PickupCollection::processModifiers(ModifierType::Enum type, float inputValue, bool addBeforeMultiplication)
+    float PickupCollection::processModifiers(ModifierType::Value type, float inputValue, bool addBeforeMultiplication)
     {
         float outputValue = inputValue;
@@ -310,5 +310,5 @@
         @return Returns the value after being processed.
     */
-    Vector3 PickupCollection::processModifiers(ModifierType::Enum type, Vector3 inputValue, bool addBeforeMultiplication)
+    Vector3 PickupCollection::processModifiers(ModifierType::Value type, Vector3 inputValue, bool addBeforeMultiplication)
     {
         Vector3 outputValue = inputValue;
Index: code/trunk/src/orxonox/objects/pickup/PickupCollection.h
===================================================================
--- code/trunk/src/orxonox/objects/pickup/PickupCollection.h	(revision 3279)
+++ code/trunk/src/orxonox/objects/pickup/PickupCollection.h	(revision 3280)
@@ -67,15 +67,15 @@
         void useItem(UsableItem* item);                                             //!< Use a usable item.
 
-        void addAdditiveModifier(ModifierType::Enum type, float value);             //!< Add an additive modifier.
-        void addMultiplicativeModifier(ModifierType::Enum type, float value);       //!< Add a multiplicative modifier.
+        void addAdditiveModifier(ModifierType::Value type, float value);             //!< Add an additive modifier.
+        void addMultiplicativeModifier(ModifierType::Value type, float value);       //!< Add a multiplicative modifier.
 
-        float getAdditiveModifier(ModifierType::Enum type);                         //!< Get total additive modifier.
-        float getMultiplicativeModifier(ModifierType::Enum type);                   //!< Get total multiplicative modifier.
+        float getAdditiveModifier(ModifierType::Value type);                         //!< Get total additive modifier.
+        float getMultiplicativeModifier(ModifierType::Value type);                   //!< Get total multiplicative modifier.
 
-        void removeAdditiveModifier(ModifierType::Enum type, float value);          //!< Remove an additive modifier.
-        void removeMultiplicativeModifier(ModifierType::Enum type, float value);    //!< Remove a multiplicative modifier.
+        void removeAdditiveModifier(ModifierType::Value type, float value);          //!< Remove an additive modifier.
+        void removeMultiplicativeModifier(ModifierType::Value type, float value);    //!< Remove a multiplicative modifier.
 
-        float processModifiers(ModifierType::Enum type, float inputValue, bool addBeforeMultiplication = false);        //!< Apply the modifiers to a float.
-        Vector3 processModifiers(ModifierType::Enum type, Vector3 inputValue, bool addBeforeMultiplication = false);    //!< Apply the modifiers to a Vector3.
+        float processModifiers(ModifierType::Value type, float inputValue, bool addBeforeMultiplication = false);        //!< Apply the modifiers to a float.
+        Vector3 processModifiers(ModifierType::Value type, Vector3 inputValue, bool addBeforeMultiplication = false);    //!< Apply the modifiers to a Vector3.
 
         /**
@@ -113,6 +113,6 @@
         bool bBlockRemovals_;   //!< Whether to block direct removals through remove().
 
-        std::multimap<ModifierType::Enum, float> additiveModifiers_;        //!< Contains additive modifiers (indexed by ModifierType).
-        std::multimap<ModifierType::Enum, float> multiplicativeModifiers_;  //!< Contains multiplicative modifiers (indexed by ModifierType).
+        std::multimap<ModifierType::Value, float> additiveModifiers_;        //!< Contains additive modifiers (indexed by ModifierType).
+        std::multimap<ModifierType::Value, float> multiplicativeModifiers_;  //!< Contains multiplicative modifiers (indexed by ModifierType).
 
         std::multimap<std::string, BaseItem*> items_;                       //!< Map of items in the collection (indexed by pickupIdentifier of the items).
Index: code/trunk/src/orxonox/objects/quest/GlobalQuest.cc
===================================================================
--- code/trunk/src/orxonox/objects/quest/GlobalQuest.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/quest/GlobalQuest.cc	(revision 3280)
@@ -147,5 +147,5 @@
             return false;
         }
-        return (this->isInactive(player) && !(this->status_ == questStatus::completed || this->status_ == questStatus::failed));
+        return (this->isInactive(player) && !(this->status_ == QuestStatus::Completed || this->status_ == QuestStatus::Failed));
     }
 
@@ -189,5 +189,5 @@
         Throws an Exception if player is NULL.
     */
-    questStatus::Enum GlobalQuest::getStatus(const PlayerInfo* player) const
+    QuestStatus::Value GlobalQuest::getStatus(const PlayerInfo* player) const
     {
         if(player == NULL) //!< We don't want NULL-Pointers!
@@ -203,5 +203,5 @@
         }
 
-        return questStatus::inactive;
+        return QuestStatus::Inactive;
     }
 
@@ -217,5 +217,5 @@
         Returns false if player is NULL.
     */
-    bool GlobalQuest::setStatus(PlayerInfo* player, const questStatus::Enum & status)
+    bool GlobalQuest::setStatus(PlayerInfo* player, const QuestStatus::Value & status)
     {
         if(player == NULL) //!< We don't want NULL-Pointers!
Index: code/trunk/src/orxonox/objects/quest/GlobalQuest.h
===================================================================
--- code/trunk/src/orxonox/objects/quest/GlobalQuest.h	(revision 3279)
+++ code/trunk/src/orxonox/objects/quest/GlobalQuest.h	(revision 3280)
@@ -97,11 +97,11 @@
             virtual bool isCompletable(const PlayerInfo* player) const; //!< Checks whether the Quest can be completed.
 
-            virtual questStatus::Enum getStatus(const PlayerInfo* player) const; //!< Returns the status of the Quest for a specific player.
+            virtual QuestStatus::Value getStatus(const PlayerInfo* player) const; //!< Returns the status of the Quest for a specific player.
             
-            virtual bool setStatus(PlayerInfo* player, const questStatus::Enum & status); //!< Sets the status for a specific player.
+            virtual bool setStatus(PlayerInfo* player, const QuestStatus::Value & status); //!< Sets the status for a specific player.
 
         private:
             std::set<PlayerInfo*> players_; //!< The set of players which possess this Quest.
-            questStatus::Enum status_; //!< The status of this Quest.
+            QuestStatus::Value status_; //!< The status of this Quest.
             std::list<QuestEffect*> rewards_; //!< Reward QuestEffects only invoked on the player completing the Quest.
             
Index: code/trunk/src/orxonox/objects/quest/LocalQuest.cc
===================================================================
--- code/trunk/src/orxonox/objects/quest/LocalQuest.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/quest/LocalQuest.cc	(revision 3280)
@@ -176,5 +176,5 @@
         Throws an Exception if player is NULL.
     */
-    questStatus::Enum LocalQuest::getStatus(const PlayerInfo* player) const
+    QuestStatus::Value LocalQuest::getStatus(const PlayerInfo* player) const
     {
         if(player == NULL) //!< No player has no defined status.
@@ -183,5 +183,5 @@
         }
 
-        std::map<const PlayerInfo*, questStatus::Enum>::const_iterator it = this->playerStatus_.find(player);
+        std::map<const PlayerInfo*, QuestStatus::Value>::const_iterator it = this->playerStatus_.find(player);
         if (it != this->playerStatus_.end()) //!< If there is a player in the map.
         {
@@ -189,5 +189,5 @@
         }
         
-        return questStatus::inactive; //!< If the player is not yet in the map, that means the status of the quest form him is 'inactive'.
+        return QuestStatus::Inactive; //!< If the player is not yet in the map, that means the status of the quest form him is 'inactive'.
     }
 
@@ -203,5 +203,5 @@
         Returns false if player is NULL.
     */
-    bool LocalQuest::setStatus(PlayerInfo* player, const questStatus::Enum & status)
+    bool LocalQuest::setStatus(PlayerInfo* player, const QuestStatus::Value & status)
     {
         if(player == NULL) //!< We can't set a status for no player.
Index: code/trunk/src/orxonox/objects/quest/LocalQuest.h
===================================================================
--- code/trunk/src/orxonox/objects/quest/LocalQuest.h	(revision 3279)
+++ code/trunk/src/orxonox/objects/quest/LocalQuest.h	(revision 3280)
@@ -91,9 +91,9 @@
             virtual bool isCompletable(const PlayerInfo* player) const; //!< Checks whether the Quest can be completed.
 
-            virtual questStatus::Enum getStatus(const PlayerInfo* player) const; //!< Returns the status of the Quest for a specific player.
-            virtual bool setStatus(PlayerInfo* player, const questStatus::Enum & status); //!< Sets the status for a specific player.
+            virtual QuestStatus::Value getStatus(const PlayerInfo* player) const; //!< Returns the status of the Quest for a specific player.
+            virtual bool setStatus(PlayerInfo* player, const QuestStatus::Value & status); //!< Sets the status for a specific player.
 
         private:
-            std::map<const PlayerInfo*, questStatus::Enum> playerStatus_; //!< List of the status for each player, with the Player-pointer as key.
+            std::map<const PlayerInfo*, QuestStatus::Value> playerStatus_; //!< List of the status for each player, with the Player-pointer as key.
 
     };
Index: code/trunk/src/orxonox/objects/quest/Quest.cc
===================================================================
--- code/trunk/src/orxonox/objects/quest/Quest.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/quest/Quest.cc	(revision 3280)
@@ -302,5 +302,5 @@
     bool Quest::isInactive(const PlayerInfo* player) const
     {
-        return this->getStatus(player) == questStatus::inactive;
+        return this->getStatus(player) == QuestStatus::Inactive;
     }
 
@@ -318,5 +318,5 @@
     {
 
-        return this->getStatus(player) == questStatus::active;
+        return this->getStatus(player) == QuestStatus::Active;
     }
 
@@ -333,5 +333,5 @@
     bool Quest::isFailed(const PlayerInfo* player) const
     {
-        return this->getStatus(player) == questStatus::failed;
+        return this->getStatus(player) == QuestStatus::Failed;
     }
 
@@ -348,5 +348,5 @@
     bool Quest::isCompleted(const PlayerInfo* player) const
     {
-        return this->getStatus(player) == questStatus::completed;
+        return this->getStatus(player) == QuestStatus::Completed;
     }
     
@@ -362,5 +362,5 @@
     {
         QuestListener::advertiseStatusChange(this->listeners_, "fail"); //!< Tells the QuestListeners, that the status has changed to failed.
-        this->setStatus(player, questStatus::failed);
+        this->setStatus(player, QuestStatus::Failed);
         
         COUT(4) << "Quest {" << this->getId() << "} is failed for player: " << player << " ." <<std::endl;
@@ -381,5 +381,5 @@
     {
         QuestListener::advertiseStatusChange(this->listeners_, "complete"); //!< Tells the QuestListeners, that the status has changed to completed.
-        this->setStatus(player, questStatus::completed);
+        this->setStatus(player, QuestStatus::Completed);
         
         COUT(4) << "Quest {" << this->getId() << "} is completed for player: " << player << " ." <<std::endl;
@@ -409,5 +409,5 @@
         QuestListener::advertiseStatusChange(this->listeners_, "start"); //!< Tells the QuestListeners, that the status has changed to active.
         
-        this->setStatus(player, questStatus::active);
+        this->setStatus(player, QuestStatus::Active);
         
         this->getDescription()->sendAddQuestNotification();
Index: code/trunk/src/orxonox/objects/quest/Quest.h
===================================================================
--- code/trunk/src/orxonox/objects/quest/Quest.h	(revision 3279)
+++ code/trunk/src/orxonox/objects/quest/Quest.h	(revision 3280)
@@ -43,16 +43,14 @@
 namespace orxonox
 {
-    namespace questStatus
+    namespace QuestStatus
     {
-
         //!Different states of a Quest.
-        enum Enum
+        enum Value
         {
-            inactive,
-            active,
-            failed,
-            completed
+            Inactive,
+            Active,
+            Failed,
+            Completed
         };
-
     }
 
@@ -133,6 +131,6 @@
                 { return this->completeEffects_; }
 
-            virtual questStatus::Enum getStatus(const PlayerInfo* player) const = 0; //!< Returns the status of the Quest for a specific player.
-            virtual bool setStatus(PlayerInfo* player, const questStatus::Enum & status) = 0; //!< Changes the status for a specific player.
+            virtual QuestStatus::Value getStatus(const PlayerInfo* player) const = 0; //!< Returns the status of the Quest for a specific player.
+            virtual bool setStatus(PlayerInfo* player, const QuestStatus::Value & status) = 0; //!< Changes the status for a specific player.
             
         private:
Index: code/trunk/src/orxonox/objects/quest/QuestEffectBeacon.cc
===================================================================
--- code/trunk/src/orxonox/objects/quest/QuestEffectBeacon.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/quest/QuestEffectBeacon.cc	(revision 3280)
@@ -53,5 +53,5 @@
         RegisterObject(QuestEffectBeacon);
         
-        this->status_ = QuestEffectBeaconStatus::active;
+        this->status_ = QuestEffectBeaconStatus::Active;
         this->times_ = INFINITE_TIME;
     }
@@ -162,9 +162,9 @@
         if(activate)
         {
-        this->status_ = QuestEffectBeaconStatus::active;
-        return true;
-        }
-        
-        this->status_ = QuestEffectBeaconStatus::inactive;
+        this->status_ = QuestEffectBeaconStatus::Active;
+        return true;
+        }
+        
+        this->status_ = QuestEffectBeaconStatus::Inactive;
         return true;
     }
@@ -190,5 +190,5 @@
         if(this->getTimes() == 0) //!< Set the QuestEffectBeacon to inactive when the number of times it can be executed is reduced to 0.
         {
-            this->status_ = QuestEffectBeaconStatus::inactive;
+            this->status_ = QuestEffectBeaconStatus::Inactive;
         }
         
Index: code/trunk/src/orxonox/objects/quest/QuestEffectBeacon.h
===================================================================
--- code/trunk/src/orxonox/objects/quest/QuestEffectBeacon.h	(revision 3279)
+++ code/trunk/src/orxonox/objects/quest/QuestEffectBeacon.h	(revision 3280)
@@ -44,12 +44,10 @@
     namespace QuestEffectBeaconStatus
     {
-
         //! The status of the beacon, can be either active or inactive.
-        enum Enum
+        enum Value
         {
-            inactive,
-            active
+            Inactive,
+            Active
         };
-
     }
 
@@ -98,5 +96,5 @@
             */
             inline bool isActive(void)
-            { return this->status_ == QuestEffectBeaconStatus::active; }
+            { return this->status_ == QuestEffectBeaconStatus::Active; }
             
             bool setActive(bool activate); //!< Set the status of the QuestEffectBeacon.
@@ -117,5 +115,5 @@
             std::list<QuestEffect*> effects_; //!< The list of QuestEffects to be invoked on the executing player.
             int times_; //!< Number of times the beacon can be exectued.
-            QuestEffectBeaconStatus::Enum status_; //!< The status of the QUestEffectBeacon, Can be eighter active or inactive.
+            QuestEffectBeaconStatus::Value status_; //!< The status of the QUestEffectBeacon, Can be eighter active or inactive.
             
             bool setTimes(const int & n); //!< Set the number of times the QuestEffectBeacon can be executed.
Index: code/trunk/src/orxonox/objects/quest/QuestHint.cc
===================================================================
--- code/trunk/src/orxonox/objects/quest/QuestHint.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/quest/QuestHint.cc	(revision 3280)
@@ -95,5 +95,5 @@
 
         //! Find the player.
-        std::map<const PlayerInfo*, questHintStatus::Enum>::const_iterator it = this->playerStatus_.find(player);
+        std::map<const PlayerInfo*, QuestHintStatus::Value>::const_iterator it = this->playerStatus_.find(player);
         if (it != this->playerStatus_.end()) //!< If the player is in the map.
         {
@@ -101,5 +101,5 @@
         }
         
-        return questStatus::inactive;
+        return QuestStatus::Inactive;
     }
 
@@ -118,5 +118,5 @@
             if(!(this->isActive(player)))  //!< If the hint is already active, activation is pointless.
             {
-                this->playerStatus_[player] = questHintStatus::active;
+                this->playerStatus_[player] = QuestHintStatus::Active;
                 
                 this->getDescription()->sendAddHintNotification();
Index: code/trunk/src/orxonox/objects/quest/QuestHint.h
===================================================================
--- code/trunk/src/orxonox/objects/quest/QuestHint.h	(revision 3279)
+++ code/trunk/src/orxonox/objects/quest/QuestHint.h	(revision 3280)
@@ -42,14 +42,12 @@
 namespace orxonox
 {
-    namespace questHintStatus
+    namespace QuestHintStatus
     {
-
         //! The state of the hint.
-        enum Enum
+        enum Value
         {
-            inactive,
-            active
+            Inactive,
+            Active
         };
-
     }
 
@@ -91,5 +89,5 @@
         private:
             Quest* quest_; //!< The Quest the QuestHint belongs to.
-            std::map<const PlayerInfo*, questHintStatus::Enum> playerStatus_; //!< List of the states for each player, with the Player-pointer as key.
+            std::map<const PlayerInfo*, QuestHintStatus::Value> playerStatus_; //!< List of the states for each player, with the Player-pointer as key.
 
     };
Index: code/trunk/src/orxonox/objects/quest/QuestListener.cc
===================================================================
--- code/trunk/src/orxonox/objects/quest/QuestListener.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/quest/QuestListener.cc	(revision 3280)
@@ -51,5 +51,5 @@
         RegisterObject(QuestListener);
         
-        this->mode_ = questListenerMode::all;
+        this->mode_ = QuestListenerMode::All;
         this->quest_ = NULL;
     }
@@ -132,22 +132,22 @@
         if(mode == "all")
         {
-            this->mode_ = questListenerMode::all;
+            this->mode_ = QuestListenerMode::All;
         }
         else if(mode == "start")
         {
-            this->mode_ = questListenerMode::start;
+            this->mode_ = QuestListenerMode::Start;
         }
         else if(mode == "fail")
         {
-            this->mode_ = questListenerMode::fail;
+            this->mode_ = QuestListenerMode::Fail;
         }
         else if(mode == "complete")
         {
-            this->mode_ = questListenerMode::complete;
+            this->mode_ = QuestListenerMode::Complete;
         }
         else
         {
             COUT(2) << "QuestListener with invalid mode '" << mode << "' created. Mode set to 'all'." << std::endl;
-        this->mode_ = questListenerMode::all;
+        this->mode_ = QuestListenerMode::All;
         return false;
         }
@@ -164,17 +164,17 @@
     std::string QuestListener::getMode(void)
     {
-        if(this->mode_ == questListenerMode::all)
+        if(this->mode_ == QuestListenerMode::All)
         {
             return "all";
         }
-        else if(this->mode_ == questListenerMode::start)
+        else if(this->mode_ == QuestListenerMode::Start)
         {
             return "start";
         }
-        else if(this->mode_ == questListenerMode::fail)
+        else if(this->mode_ == QuestListenerMode::Fail)
         {
             return "fail";
         }
-        else if(this->mode_ == questListenerMode::complete)
+        else if(this->mode_ == QuestListenerMode::Complete)
         {
             return "complete";
Index: code/trunk/src/orxonox/objects/quest/QuestListener.h
===================================================================
--- code/trunk/src/orxonox/objects/quest/QuestListener.h	(revision 3279)
+++ code/trunk/src/orxonox/objects/quest/QuestListener.h	(revision 3280)
@@ -43,16 +43,14 @@
 namespace orxonox
 {
-    namespace questListenerMode
+    namespace QuestListenerMode
     {
-
         //! The mode of the QuestListener.
-        enum Enum
+        enum Value
         {
-            all,
-            start,
-            fail,
-            complete
+            All,
+            Start,
+            Fail,
+            Complete
         };
-
     }
 
@@ -93,5 +91,5 @@
         
     private:
-        questListenerMode::Enum mode_; //!< The mode of the QuestListener.
+        QuestListenerMode::Value mode_; //!< The mode of the QuestListener.
         Quest* quest_; //!< A pointer to the Quest the QuestListener is reacting to.
     
Index: code/trunk/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.cc
===================================================================
--- code/trunk/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.cc	(revision 3280)
@@ -56,5 +56,5 @@
         this->materialBase_ = material;    
     
-        BillboardProjectile::setMaterial(material + convertToString(this->textureIndex_));
+        BillboardProjectile::setMaterial(material + multi_cast<std::string>(this->textureIndex_));
     }
 
Index: code/trunk/src/orxonox/objects/weaponsystem/projectiles/ParticleProjectile.cc
===================================================================
--- code/trunk/src/orxonox/objects/weaponsystem/projectiles/ParticleProjectile.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/weaponsystem/projectiles/ParticleProjectile.cc	(revision 3280)
@@ -44,5 +44,5 @@
         if (GameMode::showsGraphics())
         {
-            this->particles_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/shot3_small", LODParticle::normal);
+            this->particles_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/shot3_small", LODParticle::Normal);
             this->attachOgreObject(this->particles_->getParticleSystem());
             this->particles_->setKeepParticlesInLocalSpace(0);
Index: code/trunk/src/orxonox/objects/worldentities/Backlight.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/Backlight.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/worldentities/Backlight.cc	(revision 3280)
@@ -29,4 +29,5 @@
 #include "Backlight.h"
 
+#include <algorithm>
 #include <OgreRibbonTrail.h>
 #include <OgreSceneManager.h>
@@ -108,9 +109,9 @@
     void Backlight::registerVariables()
     {
-        registerVariable(this->width_,         variableDirection::toclient, new NetworkCallback<Backlight>(this, &Backlight::update_width));
-        registerVariable(this->lifetime_,      variableDirection::toclient, new NetworkCallback<Backlight>(this, &Backlight::update_lifetime));
-        registerVariable(this->length_,        variableDirection::toclient, new NetworkCallback<Backlight>(this, &Backlight::update_length));
-        registerVariable(this->maxelements_,   variableDirection::toclient, new NetworkCallback<Backlight>(this, &Backlight::update_maxelements));
-        registerVariable(this->trailmaterial_, variableDirection::toclient, new NetworkCallback<Backlight>(this, &Backlight::update_trailmaterial));
+        registerVariable(this->width_,         VariableDirection::ToClient, new NetworkCallback<Backlight>(this, &Backlight::update_width));
+        registerVariable(this->lifetime_,      VariableDirection::ToClient, new NetworkCallback<Backlight>(this, &Backlight::update_lifetime));
+        registerVariable(this->length_,        VariableDirection::ToClient, new NetworkCallback<Backlight>(this, &Backlight::update_length));
+        registerVariable(this->maxelements_,   VariableDirection::ToClient, new NetworkCallback<Backlight>(this, &Backlight::update_maxelements));
+        registerVariable(this->trailmaterial_, VariableDirection::ToClient, new NetworkCallback<Backlight>(this, &Backlight::update_trailmaterial));
     }
 
@@ -175,5 +176,5 @@
     void Backlight::stopturnonoff()
     {
-        this->postprocessingtime_ = max(0.0f, this->lifetime_ - this->turnofftime_);
+        this->postprocessingtime_ = std::max(0.0f, this->lifetime_ - this->turnofftime_);
 
         FadingBillboard::stopturnonoff();
Index: code/trunk/src/orxonox/objects/worldentities/BigExplosion.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/BigExplosion.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/worldentities/BigExplosion.cc	(revision 3280)
@@ -56,5 +56,5 @@
 */
         this->bStop_ = false;
-        this->LOD_ = LODParticle::normal;
+        this->LOD_ = LODParticle::Normal;
 
 /*      this->stf_ = "setTimeFactor ";
@@ -307,6 +307,6 @@
     void BigExplosion::registerVariables()
     {
-        registerVariable((int&)(this->LOD_), variableDirection::toclient, new NetworkCallback<BigExplosion>(this, &BigExplosion::LODchanged));
-        registerVariable(this->bStop_,       variableDirection::toclient, new NetworkCallback<BigExplosion>(this, &BigExplosion::checkStop));
+        registerVariable((int&)(this->LOD_), VariableDirection::ToClient, new NetworkCallback<BigExplosion>(this, &BigExplosion::LODchanged));
+        registerVariable(this->bStop_,       VariableDirection::ToClient, new NetworkCallback<BigExplosion>(this, &BigExplosion::checkStop));
     }
 
Index: code/trunk/src/orxonox/objects/worldentities/BigExplosion.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/BigExplosion.h	(revision 3279)
+++ code/trunk/src/orxonox/objects/worldentities/BigExplosion.h	(revision 3280)
@@ -47,7 +47,7 @@
             void registerVariables();
 
-            inline void setLOD(LODParticle::LOD level)
+            inline void setLOD(LODParticle::Value level)
                 { this->LOD_ = level; this->LODchanged(); }
-            inline LODParticle::LOD getLOD() const
+            inline LODParticle::Value getLOD() const
                 { return this->LOD_; }
 
@@ -98,5 +98,5 @@
             ParticleInterface*    explosionFire_;
 
-            LODParticle::LOD      LOD_;
+            LODParticle::Value      LOD_;
             Timer<BigExplosion> destroyTimer_;
     };
Index: code/trunk/src/orxonox/objects/worldentities/Billboard.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/Billboard.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/worldentities/Billboard.cc	(revision 3280)
@@ -69,7 +69,7 @@
     void Billboard::registerVariables()
     {
-        registerVariable(this->material_, variableDirection::toclient, new NetworkCallback<Billboard>(this, &Billboard::changedMaterial));
-        registerVariable(this->colour_,   variableDirection::toclient, new NetworkCallback<Billboard>(this, &Billboard::changedColour));
-//        registerVariable(this->rotation_, variableDirection::toclient, new NetworkCallback<Billboard>(this, &Billboard::changedRotation));
+        registerVariable(this->material_, VariableDirection::ToClient, new NetworkCallback<Billboard>(this, &Billboard::changedMaterial));
+        registerVariable(this->colour_,   VariableDirection::ToClient, new NetworkCallback<Billboard>(this, &Billboard::changedColour));
+//        registerVariable(this->rotation_, VariableDirection::ToClient, new NetworkCallback<Billboard>(this, &Billboard::changedRotation));
     }
 
Index: code/trunk/src/orxonox/objects/worldentities/BlinkingBillboard.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/BlinkingBillboard.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/worldentities/BlinkingBillboard.cc	(revision 3280)
@@ -66,7 +66,7 @@
     void BlinkingBillboard::registerVariables()
     {
-//        registerVariable(this->amplitude_, variableDirection::toclient);
-//        registerVariable(this->frequency_, variableDirection::toclient);
-//        registerVariable(this->phase_,     variableDirection::toclient);
+//        registerVariable(this->amplitude_, VariableDirection::ToClient);
+//        registerVariable(this->frequency_, VariableDirection::ToClient);
+//        registerVariable(this->phase_,     VariableDirection::ToClient);
     }
 
Index: code/trunk/src/orxonox/objects/worldentities/Camera.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/Camera.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/worldentities/Camera.cc	(revision 3280)
@@ -29,4 +29,5 @@
 #include "Camera.h"
 
+#include <algorithm>
 #include <OgreCamera.h>
 #include <OgreSceneManager.h>
@@ -34,5 +35,5 @@
 
 #include "util/Exception.h"
-#include "util/String.h"
+#include "util/StringUtils.h"
 #include "core/CoreIncludes.h"
 #include "core/ConfigValueIncludes.h"
@@ -104,5 +105,5 @@
         {
             // this stuff here may need some adjustments
-            float coeff = min(1.0f, 15.0f * dt);
+            float coeff = std::min(1.0f, 15.0f * dt);
 
             Vector3 offset = this->getWorldPosition() - this->cameraNode_->_getDerivedPosition();
Index: code/trunk/src/orxonox/objects/worldentities/ControllableEntity.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/ControllableEntity.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/worldentities/ControllableEntity.cc	(revision 3280)
@@ -79,5 +79,5 @@
 
         this->setConfigValues();
-        this->setPriority( priority::very_high );
+        this->setPriority( Priority::VeryHigh );
         this->registerVariables();
     }
@@ -238,5 +238,5 @@
             {
                 this->client_overwrite_ = this->server_overwrite_;
-                this->setObjectMode(objectDirection::bidirectional);
+                this->setObjectMode(ObjectDirection::Bidirectional);
             }
         }
@@ -254,5 +254,5 @@
         this->bHasLocalController_ = false;
         this->bHasHumanController_ = false;
-        this->setObjectMode(objectDirection::toclient);
+        this->setObjectMode(ObjectDirection::ToClient);
 
         this->changedPlayer();
@@ -368,22 +368,22 @@
     void ControllableEntity::registerVariables()
     {
-        registerVariable(this->cameraPositionTemplate_,  variableDirection::toclient);
-        registerVariable(this->hudtemplate_,             variableDirection::toclient);
-
-        registerVariable(this->server_position_,         variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerPosition));
-        registerVariable(this->server_linear_velocity_,  variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerLinearVelocity));
-        registerVariable(this->server_orientation_,      variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerOrientation));
-        registerVariable(this->server_angular_velocity_, variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerAngularVelocity));
-
-        registerVariable(this->server_overwrite_,        variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processOverwrite));
-        registerVariable(this->client_overwrite_,        variableDirection::toserver);
-
-        registerVariable(this->client_position_,         variableDirection::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientPosition));
-        registerVariable(this->client_linear_velocity_,  variableDirection::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientLinearVelocity));
-        registerVariable(this->client_orientation_,      variableDirection::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientOrientation));
-        registerVariable(this->client_angular_velocity_, variableDirection::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientAngularVelocity));
+        registerVariable(this->cameraPositionTemplate_,  VariableDirection::ToClient);
+        registerVariable(this->hudtemplate_,             VariableDirection::ToClient);
+
+        registerVariable(this->server_position_,         VariableDirection::ToClient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerPosition));
+        registerVariable(this->server_linear_velocity_,  VariableDirection::ToClient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerLinearVelocity));
+        registerVariable(this->server_orientation_,      VariableDirection::ToClient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerOrientation));
+        registerVariable(this->server_angular_velocity_, VariableDirection::ToClient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerAngularVelocity));
+
+        registerVariable(this->server_overwrite_,        VariableDirection::ToClient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processOverwrite));
+        registerVariable(this->client_overwrite_,        VariableDirection::ToServer);
+
+        registerVariable(this->client_position_,         VariableDirection::ToServer, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientPosition));
+        registerVariable(this->client_linear_velocity_,  VariableDirection::ToServer, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientLinearVelocity));
+        registerVariable(this->client_orientation_,      VariableDirection::ToServer, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientOrientation));
+        registerVariable(this->client_angular_velocity_, VariableDirection::ToServer, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientAngularVelocity));
         
 
-        registerVariable(this->playerID_,                variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::networkcallback_changedplayerID));
+        registerVariable(this->playerID_,                VariableDirection::ToClient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::networkcallback_changedplayerID));
     }
 
Index: code/trunk/src/orxonox/objects/worldentities/ExplosionChunk.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/ExplosionChunk.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/worldentities/ExplosionChunk.cc	(revision 3280)
@@ -48,5 +48,5 @@
 
         this->bStop_ = false;
-        this->LOD_ = LODParticle::normal;
+        this->LOD_ = LODParticle::Normal;
 
         if ( GameMode::showsGraphics() )
@@ -104,6 +104,6 @@
     void ExplosionChunk::registerVariables()
     {
-        registerVariable((int&)(this->LOD_), variableDirection::toclient, new NetworkCallback<ExplosionChunk>(this, &ExplosionChunk::LODchanged));
-        registerVariable(this->bStop_,       variableDirection::toclient, new NetworkCallback<ExplosionChunk>(this, &ExplosionChunk::checkStop));
+        registerVariable((int&)(this->LOD_), VariableDirection::ToClient, new NetworkCallback<ExplosionChunk>(this, &ExplosionChunk::LODchanged));
+        registerVariable(this->bStop_,       VariableDirection::ToClient, new NetworkCallback<ExplosionChunk>(this, &ExplosionChunk::checkStop));
     }
 
Index: code/trunk/src/orxonox/objects/worldentities/ExplosionChunk.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/ExplosionChunk.h	(revision 3279)
+++ code/trunk/src/orxonox/objects/worldentities/ExplosionChunk.h	(revision 3280)
@@ -46,7 +46,7 @@
             void registerVariables();
 
-            inline void setLOD(LODParticle::LOD level)
+            inline void setLOD(LODParticle::Value level)
                 { this->LOD_ = level; this->LODchanged(); }
-            inline LODParticle::LOD getLOD() const
+            inline LODParticle::Value getLOD() const
                 { return this->LOD_; }
 
@@ -60,5 +60,5 @@
             ParticleInterface*    fire_;
             ParticleInterface*    smoke_;
-            LODParticle::LOD      LOD_;
+            LODParticle::Value      LOD_;
             Timer<ExplosionChunk> destroyTimer_;
     };
Index: code/trunk/src/orxonox/objects/worldentities/FadingBillboard.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/FadingBillboard.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/worldentities/FadingBillboard.cc	(revision 3280)
@@ -64,6 +64,6 @@
     void FadingBillboard::registerVariables()
     {
-        registerVariable(this->turnontime_,  variableDirection::toclient);
-        registerVariable(this->turnofftime_, variableDirection::toclient);
+        registerVariable(this->turnontime_,  VariableDirection::ToClient);
+        registerVariable(this->turnofftime_, VariableDirection::ToClient);
     }
 
Index: code/trunk/src/orxonox/objects/worldentities/Light.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/Light.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/worldentities/Light.cc	(revision 3280)
@@ -33,5 +33,5 @@
 #include <boost/static_assert.hpp>
 
-#include "util/String.h"
+#include "util/StringUtils.h"
 #include "util/Exception.h"
 #include "core/CoreIncludes.h"
@@ -45,7 +45,7 @@
 
     // Be sure we don't do bad conversions
-    BOOST_STATIC_ASSERT((int)Ogre::Light::LT_POINT       == (int)Light::LT_POINT);
-    BOOST_STATIC_ASSERT((int)Ogre::Light::LT_DIRECTIONAL == (int)Light::LT_DIRECTIONAL);
-    BOOST_STATIC_ASSERT((int)Ogre::Light::LT_SPOTLIGHT   == (int)Light::LT_SPOTLIGHT);
+    BOOST_STATIC_ASSERT((int)Ogre::Light::LT_POINT       == (int)Light::Point);
+    BOOST_STATIC_ASSERT((int)Ogre::Light::LT_DIRECTIONAL == (int)Light::Directional);
+    BOOST_STATIC_ASSERT((int)Ogre::Light::LT_SPOTLIGHT   == (int)Light::Spotlight);
 
     Light::Light(BaseObject* creator) : StaticEntity(creator)
@@ -56,5 +56,5 @@
         this->diffuse_ = ColourValue::White;
         this->specular_ = ColourValue::White;
-        this->type_ = Light::LT_POINT;
+        this->type_ = Light::Point;
         this->attenuation_ = Vector4(100000, 1, 0, 0);
         this->spotlightRange_ = Vector3(40.0f, 30.0f, 1.0f);
@@ -106,9 +106,9 @@
     void Light::registerVariables()
     {
-        registerVariable((int&)this->type_,     variableDirection::toclient, new NetworkCallback<Light>(this, &Light::updateType));
-        registerVariable(this->diffuse_,        variableDirection::toclient, new NetworkCallback<Light>(this, &Light::updateDiffuseColour));
-        registerVariable(this->specular_,       variableDirection::toclient, new NetworkCallback<Light>(this, &Light::updateSpecularColour));
-        registerVariable(this->attenuation_,    variableDirection::toclient, new NetworkCallback<Light>(this, &Light::updateAttenuation));
-        registerVariable(this->spotlightRange_, variableDirection::toclient, new NetworkCallback<Light>(this, &Light::updateSpotlightRange));
+        registerVariable((int&)this->type_,     VariableDirection::ToClient, new NetworkCallback<Light>(this, &Light::updateType));
+        registerVariable(this->diffuse_,        VariableDirection::ToClient, new NetworkCallback<Light>(this, &Light::updateDiffuseColour));
+        registerVariable(this->specular_,       VariableDirection::ToClient, new NetworkCallback<Light>(this, &Light::updateSpecularColour));
+        registerVariable(this->attenuation_,    VariableDirection::ToClient, new NetworkCallback<Light>(this, &Light::updateAttenuation));
+        registerVariable(this->spotlightRange_, VariableDirection::ToClient, new NetworkCallback<Light>(this, &Light::updateSpotlightRange));
     }
 
@@ -127,5 +127,5 @@
     void Light::updateAttenuation()
     {
-        if (this->light_ && this->type_ != Light::LT_DIRECTIONAL)
+        if (this->light_ && this->type_ != Light::Directional)
             this->light_->setAttenuation(this->attenuation_.x, this->attenuation_.y, this->attenuation_.z, this->attenuation_.w);
     }
@@ -133,5 +133,5 @@
     void Light::updateSpotlightRange()
     {
-        if (this->light_ && this->type_ == Light::LT_SPOTLIGHT)
+        if (this->light_ && this->type_ == Light::Spotlight)
             this->light_->setSpotlightRange(Degree(this->spotlightRange_.x), Degree(this->spotlightRange_.y), this->spotlightRange_.z);
     }
@@ -140,11 +140,11 @@
     {
         if (type == "point")
-            this->setType(Light::LT_POINT);
+            this->setType(Light::Point);
         else if (type == "directional")
-            this->setType(Light::LT_DIRECTIONAL);
+            this->setType(Light::Directional);
         else if (type == "spotlight")
-            this->setType(Light::LT_SPOTLIGHT);
+            this->setType(Light::Spotlight);
         else
-            this->setType(Light::LT_POINT);
+            this->setType(Light::Point);
     }
 
@@ -153,9 +153,9 @@
         switch (this->type_)
         {
-            case Light::LT_DIRECTIONAL:
+            case Light::Directional:
                 return "directional";
-            case Light::LT_SPOTLIGHT:
+            case Light::Spotlight:
                 return "spotlight";
-            case Light::LT_POINT:
+            case Light::Point:
             default:
                 return "point";
@@ -169,7 +169,7 @@
             this->light_->setType(static_cast<Ogre::Light::LightTypes>(this->type_));
 
-            if (this->type_ != Light::LT_DIRECTIONAL)
+            if (this->type_ != Light::Directional)
                 this->updateAttenuation();
-            if (this->type_ == Light::LT_SPOTLIGHT)
+            if (this->type_ == Light::Spotlight)
                 this->updateSpotlightRange();
         }
Index: code/trunk/src/orxonox/objects/worldentities/Light.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/Light.h	(revision 3279)
+++ code/trunk/src/orxonox/objects/worldentities/Light.h	(revision 3280)
@@ -45,9 +45,9 @@
             {
                 /// Point light sources give off light equally in all directions, so require only position not direction
-                LT_POINT,
+                Point,
                 /// Directional lights simulate parallel light beams from a distant source, hence have direction but no position
-                LT_DIRECTIONAL,
+                Directional,
                 /// Spotlights simulate a cone of light from a source so require position and direction, plus extra values for falloff
-                LT_SPOTLIGHT
+                Spotlight
             };
 
Index: code/trunk/src/orxonox/objects/worldentities/Model.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/Model.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/worldentities/Model.cc	(revision 3280)
@@ -65,6 +65,6 @@
     void Model::registerVariables()
     {
-        registerVariable(this->meshSrc_,    variableDirection::toclient, new NetworkCallback<Model>(this, &Model::changedMesh));
-        registerVariable(this->bCastShadows_, variableDirection::toclient, new NetworkCallback<Model>(this, &Model::changedShadows));
+        registerVariable(this->meshSrc_,    VariableDirection::ToClient, new NetworkCallback<Model>(this, &Model::changedMesh));
+        registerVariable(this->bCastShadows_, VariableDirection::ToClient, new NetworkCallback<Model>(this, &Model::changedShadows));
     }
 
Index: code/trunk/src/orxonox/objects/worldentities/MovableEntity.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/MovableEntity.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/worldentities/MovableEntity.cc	(revision 3280)
@@ -52,5 +52,5 @@
         this->continuousResynchroTimer_ = 0;
 
-        this->setPriority(priority::low);
+        this->setPriority(Priority::Low);
 
         this->registerVariables();
@@ -89,9 +89,9 @@
     void MovableEntity::registerVariables()
     {
-        registerVariable(this->linearVelocity_,        variableDirection::toclient, new NetworkCallback<MovableEntity>(this, &MovableEntity::processLinearVelocity));
-        registerVariable(this->angularVelocity_,       variableDirection::toclient, new NetworkCallback<MovableEntity>(this, &MovableEntity::processAngularVelocity));
+        registerVariable(this->linearVelocity_,        VariableDirection::ToClient, new NetworkCallback<MovableEntity>(this, &MovableEntity::processLinearVelocity));
+        registerVariable(this->angularVelocity_,       VariableDirection::ToClient, new NetworkCallback<MovableEntity>(this, &MovableEntity::processAngularVelocity));
 
-        registerVariable(this->overwrite_position_,    variableDirection::toclient, new NetworkCallback<MovableEntity>(this, &MovableEntity::overwritePosition));
-        registerVariable(this->overwrite_orientation_, variableDirection::toclient, new NetworkCallback<MovableEntity>(this, &MovableEntity::overwriteOrientation));
+        registerVariable(this->overwrite_position_,    VariableDirection::ToClient, new NetworkCallback<MovableEntity>(this, &MovableEntity::overwritePosition));
+        registerVariable(this->overwrite_orientation_, VariableDirection::ToClient, new NetworkCallback<MovableEntity>(this, &MovableEntity::overwriteOrientation));
     }
 
Index: code/trunk/src/orxonox/objects/worldentities/ParticleEmitter.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/ParticleEmitter.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/worldentities/ParticleEmitter.cc	(revision 3280)
@@ -53,5 +53,5 @@
 
         this->particles_ = 0;
-        this->LOD_ = LODParticle::normal;
+        this->LOD_ = LODParticle::Normal;
 
         this->registerVariables();
@@ -71,5 +71,5 @@
         SUPER(ParticleEmitter, XMLPort, xmlelement, mode);
 
-        XMLPortParam(ParticleEmitter, "lod",    setLODxml, getLODxml, xmlelement, mode).defaultValues(LODParticle::normal);
+        XMLPortParam(ParticleEmitter, "lod",    setLODxml, getLODxml, xmlelement, mode).defaultValues(LODParticle::Normal);
         XMLPortParam(ParticleEmitter, "source", setSource, getSource, xmlelement, mode);
     }
@@ -77,6 +77,6 @@
     void ParticleEmitter::registerVariables()
     {
-        registerVariable(this->source_, variableDirection::toclient, new NetworkCallback<ParticleEmitter>(this, &ParticleEmitter::sourceChanged));
-        registerVariable((int&)(this->LOD_),    variableDirection::toclient, new NetworkCallback<ParticleEmitter>(this, &ParticleEmitter::LODchanged));
+        registerVariable(this->source_, VariableDirection::ToClient, new NetworkCallback<ParticleEmitter>(this, &ParticleEmitter::sourceChanged));
+        registerVariable((int&)(this->LOD_),    VariableDirection::ToClient, new NetworkCallback<ParticleEmitter>(this, &ParticleEmitter::LODchanged));
     }
 
Index: code/trunk/src/orxonox/objects/worldentities/ParticleEmitter.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/ParticleEmitter.h	(revision 3279)
+++ code/trunk/src/orxonox/objects/worldentities/ParticleEmitter.h	(revision 3280)
@@ -57,12 +57,12 @@
                 { return this->source_; }
 
-            inline void setLOD(LODParticle::LOD level)
+            inline void setLOD(LODParticle::Value level)
                 { this->LOD_ = level; this->LODchanged(); }
-            inline LODParticle::LOD getLOD() const
+            inline LODParticle::Value getLOD() const
                 { return this->LOD_; }
 
         protected:
             inline void setLODxml(unsigned int level)
-                { this->LOD_ = (LODParticle::LOD)level; this->LODchanged(); }
+                { this->LOD_ = (LODParticle::Value)level; this->LODchanged(); }
             inline unsigned int getLODxml() const
                 { return (unsigned int)this->LOD_; }
@@ -73,5 +73,5 @@
             ParticleInterface* particles_;
             std::string        source_;
-            LODParticle::LOD   LOD_;
+            LODParticle::Value   LOD_;
     };
 }
Index: code/trunk/src/orxonox/objects/worldentities/Planet.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/Planet.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/worldentities/Planet.cc	(revision 3280)
@@ -157,9 +157,9 @@
     void Planet::registerVariables()
     {
-        registerVariable(this->atmosphere_, variableDirection::toclient);
-        registerVariable(this->meshSrc_, variableDirection::toclient, new NetworkCallback<Planet>(this, &Planet::changedMesh));
-        registerVariable(this->bCastShadows_, variableDirection::toclient, new NetworkCallback<Planet>(this, &Planet::changedShadows));
-        registerVariable(this->atmosphereSize, variableDirection::toclient);
-        registerVariable(this->imageSize, variableDirection::toclient);
+        registerVariable(this->atmosphere_, VariableDirection::ToClient);
+        registerVariable(this->meshSrc_, VariableDirection::ToClient, new NetworkCallback<Planet>(this, &Planet::changedMesh));
+        registerVariable(this->bCastShadows_, VariableDirection::ToClient, new NetworkCallback<Planet>(this, &Planet::changedShadows));
+        registerVariable(this->atmosphereSize, VariableDirection::ToClient);
+        registerVariable(this->imageSize, VariableDirection::ToClient);
     }
 
Index: code/trunk/src/orxonox/objects/worldentities/PongBall.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/PongBall.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/worldentities/PongBall.cc	(revision 3280)
@@ -72,5 +72,5 @@
         registerVariable( this->relMercyOffset_ );
         registerVariable( this->batID_[0] );
-        registerVariable( this->batID_[1], variableDirection::toclient, new NetworkCallback<PongBall>( this, &PongBall::applyBats) );
+        registerVariable( this->batID_[1], VariableDirection::ToClient, new NetworkCallback<PongBall>( this, &PongBall::applyBats) );
     }
 
Index: code/trunk/src/orxonox/objects/worldentities/StaticEntity.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/StaticEntity.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/worldentities/StaticEntity.cc	(revision 3280)
@@ -43,5 +43,5 @@
         RegisterObject(StaticEntity);
         
-        this->setPriority(priority::very_low);
+        this->setPriority(Priority::VeryLow);
 
         this->registerVariables();
@@ -54,6 +54,6 @@
     void StaticEntity::registerVariables()
     {
-        registerVariable(this->getPosition(),    variableDirection::toclient, new NetworkCallback<StaticEntity>(this, &StaticEntity::positionChanged));
-        registerVariable(this->getOrientation(), variableDirection::toclient, new NetworkCallback<StaticEntity>(this, &StaticEntity::orientationChanged));
+        registerVariable(this->getPosition(),    VariableDirection::ToClient, new NetworkCallback<StaticEntity>(this, &StaticEntity::positionChanged));
+        registerVariable(this->getOrientation(), VariableDirection::ToClient, new NetworkCallback<StaticEntity>(this, &StaticEntity::orientationChanged));
     }
 
Index: code/trunk/src/orxonox/objects/worldentities/WorldEntity.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/WorldEntity.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/worldentities/WorldEntity.cc	(revision 3280)
@@ -175,29 +175,29 @@
     void WorldEntity::registerVariables()
     {
-        registerVariable(this->mainStateName_,  variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::changedMainState));
-
-        registerVariable(this->bActive_,        variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::changedActivity));
-        registerVariable(this->bVisible_,       variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::changedVisibility));
-
-        registerVariable(this->getScale3D(),    variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::scaleChanged));
+        registerVariable(this->mainStateName_,  VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::changedMainState));
+
+        registerVariable(this->bActive_,        VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::changedActivity));
+        registerVariable(this->bVisible_,       VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::changedVisibility));
+
+        registerVariable(this->getScale3D(),    VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::scaleChanged));
 
         // Physics stuff
-        registerVariable(this->mass_,           variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::massChanged));
-        registerVariable(this->restitution_,    variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::restitutionChanged));
-        registerVariable(this->angularFactor_,  variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::angularFactorChanged));
-        registerVariable(this->linearDamping_,  variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::linearDampingChanged));
-        registerVariable(this->angularDamping_, variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::angularDampingChanged));
-        registerVariable(this->friction_,       variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::frictionChanged));
+        registerVariable(this->mass_,           VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::massChanged));
+        registerVariable(this->restitution_,    VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::restitutionChanged));
+        registerVariable(this->angularFactor_,  VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::angularFactorChanged));
+        registerVariable(this->linearDamping_,  VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::linearDampingChanged));
+        registerVariable(this->angularDamping_, VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::angularDampingChanged));
+        registerVariable(this->friction_,       VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::frictionChanged));
         registerVariable(this->bCollisionCallbackActive_,
-                                                variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::collisionCallbackActivityChanged));
+                                                VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::collisionCallbackActivityChanged));
         registerVariable(this->bCollisionResponseActive_,
-                                                variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::collisionResponseActivityChanged));
+                                                VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::collisionResponseActivityChanged));
         registerVariable((int&)this->collisionTypeSynchronised_,
-                                                variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::collisionTypeChanged));
+                                                VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::collisionTypeChanged));
         registerVariable(this->bPhysicsActiveSynchronised_,
-                                                variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::physicsActivityChanged));
+                                                VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::physicsActivityChanged));
 
         // Attach to parent if necessary
-        registerVariable(this->parentID_,       variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::networkcallback_parentChanged));
+        registerVariable(this->parentID_,       VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::networkcallback_parentChanged));
     }
 
Index: code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc	(revision 3280)
@@ -28,4 +28,6 @@
 
 #include "Pawn.h"
+
+#include <algorithm>
 
 #include "core/CoreIncludes.h"
@@ -117,8 +119,8 @@
     void Pawn::registerVariables()
     {
-        registerVariable(this->bAlive_,        variableDirection::toclient);
-        registerVariable(this->health_,        variableDirection::toclient);
-        registerVariable(this->initialHealth_, variableDirection::toclient);
-        registerVariable(this->bReload_,       variableDirection::toserver);
+        registerVariable(this->bAlive_,        VariableDirection::ToClient);
+        registerVariable(this->health_,        VariableDirection::ToClient);
+        registerVariable(this->initialHealth_, VariableDirection::ToClient);
+        registerVariable(this->bReload_,       VariableDirection::ToServer);
     }
 
@@ -152,5 +154,5 @@
     void Pawn::setHealth(float health)
     {
-        this->health_ = min(health, this->maxHealth_);
+        this->health_ = std::min(health, this->maxHealth_);
     }
 
Index: code/trunk/src/orxonox/objects/worldentities/pawns/SpaceShip.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/pawns/SpaceShip.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/worldentities/pawns/SpaceShip.cc	(revision 3280)
@@ -90,7 +90,7 @@
     void SpaceShip::registerVariables()
     {
-        registerVariable(this->primaryThrust_,  variableDirection::toclient);
-        registerVariable(this->auxilaryThrust_, variableDirection::toclient);
-        registerVariable(this->rotationThrust_, variableDirection::toclient);
+        registerVariable(this->primaryThrust_,  VariableDirection::ToClient);
+        registerVariable(this->auxilaryThrust_, VariableDirection::ToClient);
+        registerVariable(this->rotationThrust_, VariableDirection::ToClient);
     }
 
Index: code/trunk/src/orxonox/objects/worldentities/pawns/Spectator.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/pawns/Spectator.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/worldentities/pawns/Spectator.cc	(revision 3280)
@@ -93,6 +93,6 @@
     void Spectator::registerVariables()
     {
-        registerVariable(this->bGreetingFlareVisible_, variableDirection::toclient, new NetworkCallback<Spectator>(this, &Spectator::changedFlareVisibility));
-        registerVariable(this->bGreeting_,             variableDirection::toserver, new NetworkCallback<Spectator>(this, &Spectator::changedGreeting));
+        registerVariable(this->bGreetingFlareVisible_, VariableDirection::ToClient, new NetworkCallback<Spectator>(this, &Spectator::changedFlareVisibility));
+        registerVariable(this->bGreeting_,             VariableDirection::ToServer, new NetworkCallback<Spectator>(this, &Spectator::changedGreeting));
     }
 
@@ -145,5 +145,5 @@
         ControllableEntity::setPlayer(player);
 
-//        this->setObjectMode(objectDirection::toclient);
+//        this->setObjectMode(ObjectDirection::ToClient);
     }
 
Index: code/trunk/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.cc	(revision 3280)
@@ -43,5 +43,5 @@
         RegisterObject(TeamBaseMatchBase);
 
-        this->state_ = BaseState::uncontrolled;
+        this->state_ = BaseState::Uncontrolled;
 
         TeamBaseMatch* gametype = dynamic_cast<TeamBaseMatch*>(this->getGametype());
@@ -66,11 +66,11 @@
         switch (this->state_)
         {
-            case BaseState::controlTeam1:
+            case BaseState::ControlTeam1:
                 colour = gametype->getTeamColour(0);
                 break;
-            case BaseState::controlTeam2:
+            case BaseState::ControlTeam2:
                 colour = gametype->getTeamColour(1);
                 break;
-            case BaseState::uncontrolled:
+            case BaseState::Uncontrolled:
             default:
                 colour = ColourValue(0.5, 0.5, 0.5, 1.0);
Index: code/trunk/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.h	(revision 3279)
+++ code/trunk/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.h	(revision 3280)
@@ -38,9 +38,9 @@
     namespace BaseState
     {
-        enum Enum
+        enum Value
         {
-            uncontrolled,
-            controlTeam1,
-            controlTeam2,
+            Uncontrolled,
+            ControlTeam1,
+            ControlTeam2,
         };
     }
@@ -58,5 +58,5 @@
 
             // Set the state of a base to whatever the argument of the function is
-            void setState(BaseState::Enum state)
+            void setState(BaseState::Value state)
             {
                 this->state_ = state;
@@ -66,5 +66,5 @@
 
             // Get the state of a base as a return value
-            BaseState::Enum getState() const
+            BaseState::Value getState() const
             {
                 return this->state_;
@@ -75,5 +75,5 @@
             void changeTeamColour();
 
-            BaseState::Enum state_;
+            BaseState::Value state_;
     };
 }
Index: code/trunk/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc	(revision 3280)
@@ -141,5 +141,5 @@
   }
 
-  bool DistanceTrigger::isTriggered(TriggerMode mode)
+  bool DistanceTrigger::isTriggered(TriggerMode::Value mode)
   {
     if (Trigger::isTriggered(mode))
Index: code/trunk/src/orxonox/objects/worldentities/triggers/DistanceTrigger.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/triggers/DistanceTrigger.h	(revision 3279)
+++ code/trunk/src/orxonox/objects/worldentities/triggers/DistanceTrigger.h	(revision 3280)
@@ -59,5 +59,5 @@
 
     protected:
-      virtual bool isTriggered(TriggerMode mode);
+      virtual bool isTriggered(TriggerMode::Value mode);
       virtual void notifyMaskUpdate() {}
 
Index: code/trunk/src/orxonox/objects/worldentities/triggers/EventTrigger.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/triggers/EventTrigger.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/worldentities/triggers/EventTrigger.cc	(revision 3280)
@@ -54,5 +54,5 @@
     }
 
-    bool EventTrigger::isTriggered(TriggerMode mode)
+    bool EventTrigger::isTriggered(TriggerMode::Value mode)
     {
         if (Trigger::isTriggered(mode))
Index: code/trunk/src/orxonox/objects/worldentities/triggers/EventTrigger.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/triggers/EventTrigger.h	(revision 3279)
+++ code/trunk/src/orxonox/objects/worldentities/triggers/EventTrigger.h	(revision 3280)
@@ -47,5 +47,5 @@
 
         protected:
-            virtual bool isTriggered(TriggerMode mode);
+            virtual bool isTriggered(TriggerMode::Value mode);
 
         private:
Index: code/trunk/src/orxonox/objects/worldentities/triggers/PlayerTrigger.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/triggers/PlayerTrigger.h	(revision 3279)
+++ code/trunk/src/orxonox/objects/worldentities/triggers/PlayerTrigger.h	(revision 3280)
@@ -70,5 +70,5 @@
             
     protected:
-        virtual bool isTriggered(TriggerMode mode) = 0;
+        virtual bool isTriggered(TriggerMode::Value mode) = 0;
         
         /**
Index: code/trunk/src/orxonox/objects/worldentities/triggers/Trigger.cc
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/triggers/Trigger.cc	(revision 3279)
+++ code/trunk/src/orxonox/objects/worldentities/triggers/Trigger.cc	(revision 3280)
@@ -46,5 +46,5 @@
     RegisterObject(Trigger);
 
-    this->mode_ = TM_EventTriggerAND;
+    this->mode_ = TriggerMode::EventTriggerAND;
 
     this->bFirstTick_ = true;
@@ -163,5 +163,5 @@
   }
 
-  bool Trigger::isTriggered(TriggerMode mode)
+  bool Trigger::isTriggered(TriggerMode::Value mode)
   {
 //    if (this->bUpdating_)
@@ -175,11 +175,11 @@
       switch (mode)
       {
-        case TM_EventTriggerAND:
+        case TriggerMode::EventTriggerAND:
           returnval = checkAnd();
           break;
-        case TM_EventTriggerOR:
+        case TriggerMode::EventTriggerOR:
           returnval = checkOr();
           break;
-        case TM_EventTriggerXOR:
+        case TriggerMode::EventTriggerXOR:
           returnval = checkXor();
           break;
@@ -270,18 +270,18 @@
   {
     if (modeName == "and")
-      this->setMode(TM_EventTriggerAND);
+      this->setMode(TriggerMode::EventTriggerAND);
     else if (modeName == "or")
-      this->setMode(TM_EventTriggerOR);
+      this->setMode(TriggerMode::EventTriggerOR);
     else if (modeName == "xor")
-      this->setMode(TM_EventTriggerXOR);
+      this->setMode(TriggerMode::EventTriggerXOR);
   }
 
   std::string Trigger::getModeString() const
   {
-    if (this->mode_ == TM_EventTriggerAND)
+    if (this->mode_ == TriggerMode::EventTriggerAND)
       return std::string("and");
-    else if (this->mode_ == TM_EventTriggerOR)
+    else if (this->mode_ == TriggerMode::EventTriggerOR)
       return std::string("or");
-    else if (this->mode_ == TM_EventTriggerXOR)
+    else if (this->mode_ == TriggerMode::EventTriggerXOR)
       return std::string("xor");
     else
Index: code/trunk/src/orxonox/objects/worldentities/triggers/Trigger.h
===================================================================
--- code/trunk/src/orxonox/objects/worldentities/triggers/Trigger.h	(revision 3279)
+++ code/trunk/src/orxonox/objects/worldentities/triggers/Trigger.h	(revision 3280)
@@ -41,10 +41,13 @@
 namespace orxonox
 {
-  enum TriggerMode
+  namespace TriggerMode
   {
-    TM_EventTriggerAND,
-    TM_EventTriggerOR,
-    TM_EventTriggerXOR,
-  };
+    enum Value
+    {
+      EventTriggerAND,
+      EventTriggerOR,
+      EventTriggerXOR,
+    };
+  }
 
   class _OrxonoxExport Trigger : public StaticEntity, public Tickable
@@ -64,7 +67,7 @@
 
       void setMode(const std::string& modeName);
-      inline void setMode(TriggerMode mode)
+      inline void setMode(TriggerMode::Value mode)
         { this->mode_ = mode; }
-      inline TriggerMode getMode() const
+      inline TriggerMode::Value getMode() const
         { return mode_; }
 
@@ -103,5 +106,5 @@
     protected:
       inline bool isTriggered() { return this->isTriggered(this->mode_); }
-      virtual bool isTriggered(TriggerMode mode);
+      virtual bool isTriggered(TriggerMode::Value mode);
       virtual void triggered(bool bIsTriggered);
 
@@ -118,5 +121,5 @@
       bool bFirstTick_;
 
-      TriggerMode mode_;
+      TriggerMode::Value mode_;
       bool bInvertMode_;
       bool bSwitch_;
Index: code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc
===================================================================
--- code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc	(revision 3279)
+++ code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc	(revision 3280)
@@ -42,5 +42,5 @@
 #include "util/Convert.h"
 #include "util/Exception.h"
-#include "util/String.h"
+#include "util/StringUtils.h"
 #include "core/GameMode.h"
 #include "core/CoreIncludes.h"
@@ -72,10 +72,10 @@
         // create the Ogre::Overlay
         overlay_ = Ogre::OverlayManager::getSingleton().create("OrxonoxOverlay_overlay_"
-            + convertToString(hudOverlayCounter_s++));
+            + multi_cast<std::string>(hudOverlayCounter_s++));
 
         // create background panel (can be used to show any picture)
         this->background_ = static_cast<Ogre::PanelOverlayElement*>(
             Ogre::OverlayManager::getSingleton().createOverlayElement("Panel",
-            "OrxonoxOverlay_background_" + convertToString(hudOverlayCounter_s++)));
+            "OrxonoxOverlay_background_" + multi_cast<std::string>(hudOverlayCounter_s++)));
         this->overlay_->add2D(this->background_);
 
Index: code/trunk/src/orxonox/overlays/OverlayText.cc
===================================================================
--- code/trunk/src/orxonox/overlays/OverlayText.cc	(revision 3279)
+++ code/trunk/src/orxonox/overlays/OverlayText.cc	(revision 3280)
@@ -34,5 +34,5 @@
 #include <boost/static_assert.hpp>
 
-#include "util/String.h"
+#include "util/StringUtils.h"
 #include "core/CoreIncludes.h"
 #include "core/XMLPort.h"
Index: code/trunk/src/orxonox/overlays/console/InGameConsole.cc
===================================================================
--- code/trunk/src/orxonox/overlays/console/InGameConsole.cc	(revision 3279)
+++ code/trunk/src/orxonox/overlays/console/InGameConsole.cc	(revision 3280)
@@ -30,4 +30,5 @@
 #include "InGameConsole.h"
 
+#include <algorithm>
 #include <string>
 #include <OgreOverlay.h>
@@ -219,5 +220,5 @@
         for (int i = 0; i < LINES; i++)
         {
-            this->consoleOverlayTextAreas_[i] = static_cast<Ogre::TextAreaOverlayElement*>(ovMan->createOverlayElement("TextArea", "InGameConsoleTextArea" + convertToString(i)));
+            this->consoleOverlayTextAreas_[i] = static_cast<Ogre::TextAreaOverlayElement*>(ovMan->createOverlayElement("TextArea", "InGameConsoleTextArea" + multi_cast<std::string>(i)));
             this->consoleOverlayTextAreas_[i]->setMetricsMode(Ogre::GMM_PIXELS);
             this->consoleOverlayTextAreas_[i]->setFontName("MonofurConsole");
@@ -425,5 +426,5 @@
 
         if (LINES > 0)
-            this->maxCharsPerLine_ = max((unsigned int)10, (unsigned int) ((float)this->desiredTextWidth_ / CHAR_WIDTH));
+            this->maxCharsPerLine_ = std::max((unsigned int)10, (unsigned int) ((float)this->desiredTextWidth_ / CHAR_WIDTH));
         else
             this->maxCharsPerLine_ = 10;
Index: code/trunk/src/orxonox/overlays/hud/GametypeStatus.cc
===================================================================
--- code/trunk/src/orxonox/overlays/hud/GametypeStatus.cc	(revision 3279)
+++ code/trunk/src/orxonox/overlays/hud/GametypeStatus.cc	(revision 3280)
@@ -70,5 +70,5 @@
             {
                 if (gtinfo->isStartCountdownRunning())
-                    this->setCaption(convertToString((int)ceil(gtinfo->getStartCountdown())));
+                    this->setCaption(multi_cast<std::string>((int)ceil(gtinfo->getStartCountdown())));
                 else if (ce->isA(Class(Spectator)))
                     this->setCaption("Press [Fire] to respawn");
Index: code/trunk/src/orxonox/overlays/hud/HUDBar.cc
===================================================================
--- code/trunk/src/orxonox/overlays/hud/HUDBar.cc	(revision 3279)
+++ code/trunk/src/orxonox/overlays/hud/HUDBar.cc	(revision 3280)
@@ -38,5 +38,5 @@
 
 #include "util/Convert.h"
-#include "util/String.h"
+#include "util/StringUtils.h"
 #include "core/CoreIncludes.h"
 #include "core/XMLPort.h"
@@ -72,5 +72,5 @@
 
         // create new material
-        std::string materialname = "barmaterial" + getConvertedValue<unsigned int, std::string>(materialcount_s++);
+        std::string materialname = "barmaterial" + multi_cast<std::string>(materialcount_s++);
         Ogre::MaterialPtr material = (Ogre::MaterialPtr)Ogre::MaterialManager::getSingleton().create(materialname, "General");
         material->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
Index: code/trunk/src/orxonox/overlays/hud/HUDHealthBar.cc
===================================================================
--- code/trunk/src/orxonox/overlays/hud/HUDHealthBar.cc	(revision 3279)
+++ code/trunk/src/orxonox/overlays/hud/HUDHealthBar.cc	(revision 3280)
@@ -83,5 +83,5 @@
         {
             this->setValue(this->owner_->getHealth() / this->owner_->getInitialHealth());
-            this->textoverlay_->setCaption(convertToString((int)this->owner_->getHealth()));
+            this->textoverlay_->setCaption(multi_cast<std::string>((int)this->owner_->getHealth()));
         }
 
Index: code/trunk/src/orxonox/overlays/hud/HUDNavigation.cc
===================================================================
--- code/trunk/src/orxonox/overlays/hud/HUDNavigation.cc	(revision 3279)
+++ code/trunk/src/orxonox/overlays/hud/HUDNavigation.cc	(revision 3280)
@@ -35,5 +35,5 @@
 
 #include "util/Math.h"
-#include "util/String.h"
+#include "util/StringUtils.h"
 #include "util/Convert.h"
 #include "core/CoreIncludes.h"
@@ -142,6 +142,6 @@
         // set text
         int dist = (int) getDist2Focus();
-        navText_->setCaption(convertToString(dist));
-        float textLength = convertToString(dist).size() * navText_->getCharHeight() * 0.3;
+        navText_->setCaption(multi_cast<std::string>(dist));
+        float textLength = multi_cast<std::string>(dist).size() * navText_->getCharHeight() * 0.3;
 
 /*
Index: code/trunk/src/orxonox/overlays/hud/HUDRadar.cc
===================================================================
--- code/trunk/src/orxonox/overlays/hud/HUDRadar.cc	(revision 3279)
+++ code/trunk/src/orxonox/overlays/hud/HUDRadar.cc	(revision 3280)
@@ -34,5 +34,5 @@
 
 #include "util/Math.h"
-#include "util/String.h"
+#include "util/StringUtils.h"
 #include "core/CoreIncludes.h"
 #include "core/XMLPort.h"
Index: code/trunk/src/orxonox/overlays/hud/HUDTimer.cc
===================================================================
--- code/trunk/src/orxonox/overlays/hud/HUDTimer.cc	(revision 3279)
+++ code/trunk/src/orxonox/overlays/hud/HUDTimer.cc	(revision 3280)
@@ -59,5 +59,5 @@
             if (gametype->getTimerIsActive())
             {
-                this->setCaption(convertToString((int)gametype->getTime() + 1));
+                this->setCaption(multi_cast<std::string>((int)gametype->getTime() + 1));
             }
         }
Index: code/trunk/src/orxonox/overlays/hud/PongScore.cc
===================================================================
--- code/trunk/src/orxonox/overlays/hud/PongScore.cc	(revision 3279)
+++ code/trunk/src/orxonox/overlays/hud/PongScore.cc	(revision 3280)
@@ -83,5 +83,5 @@
             {
                 name1 = player1->getName();
-                score1 = convertToString(this->owner_->getScore(player1));
+                score1 = multi_cast<std::string>(this->owner_->getScore(player1));
             }
 
@@ -89,5 +89,5 @@
             {
                 name2 = player2->getName();
-                score2 = convertToString(this->owner_->getScore(player2));
+                score2 = multi_cast<std::string>(this->owner_->getScore(player2));
             }
 
Index: code/trunk/src/orxonox/overlays/hud/TeamBaseMatchScore.cc
===================================================================
--- code/trunk/src/orxonox/overlays/hud/TeamBaseMatchScore.cc	(revision 3279)
+++ code/trunk/src/orxonox/overlays/hud/TeamBaseMatchScore.cc	(revision 3280)
@@ -71,9 +71,9 @@
         if (this->owner_)
         {
-            std::string bases1 = "(" + convertToString(this->owner_->getTeamBases(0)) + ")";
-            std::string bases2 = "(" + convertToString(this->owner_->getTeamBases(1)) + ")";
+            std::string bases1 = "(" + multi_cast<std::string>(this->owner_->getTeamBases(0)) + ")";
+            std::string bases2 = "(" + multi_cast<std::string>(this->owner_->getTeamBases(1)) + ")";
 
-            std::string score1 = convertToString(this->owner_->getTeamPoints(0));
-            std::string score2 = convertToString(this->owner_->getTeamPoints(1));
+            std::string score1 = multi_cast<std::string>(this->owner_->getTeamPoints(0));
+            std::string score2 = multi_cast<std::string>(this->owner_->getTeamPoints(1));
 
             std::string output1;
Index: code/trunk/src/orxonox/overlays/stats/CreateLines.cc
===================================================================
--- code/trunk/src/orxonox/overlays/stats/CreateLines.cc	(revision 3279)
+++ code/trunk/src/orxonox/overlays/stats/CreateLines.cc	(revision 3280)
@@ -99,5 +99,5 @@
     //    while (textColumns_.size() < numberOfColumns)
     //    {
-    //        Ogre::TextAreaOverlayElement* tempTextArea = static_cast<Ogre::TextAreaOverlayElement*>(ovMan->createOverlayElement("TextArea", "StatsLineTextArea" + getName() + convertToString(lineIndex) + convertToString(colIndex)));
+    //        Ogre::TextAreaOverlayElement* tempTextArea = static_cast<Ogre::TextAreaOverlayElement*>(ovMan->createOverlayElement("TextArea", "StatsLineTextArea" + getName() + multi_cast<std::string>(lineIndex) + multi_cast<std::string>(colIndex)));
     //        textColumns_.push_back(tempTextArea);
     //        this->background_->addChild(tempTextArea);
Index: code/trunk/src/orxonox/overlays/stats/Stats.cc
===================================================================
--- code/trunk/src/orxonox/overlays/stats/Stats.cc	(revision 3279)
+++ code/trunk/src/orxonox/overlays/stats/Stats.cc	(revision 3280)
@@ -33,5 +33,5 @@
 #include <OgreBorderPanelOverlayElement.h>
 
-#include "util/String.h"
+#include "util/StringUtils.h"
 #include "core/CoreIncludes.h"
 #include "core/ConfigValueIncludes.h"
Index: code/trunk/src/orxonox/sound/SoundManager.cc
===================================================================
--- code/trunk/src/orxonox/sound/SoundManager.cc	(revision 3279)
+++ code/trunk/src/orxonox/sound/SoundManager.cc	(revision 3280)
@@ -39,5 +39,4 @@
 {
     SoundManager* SoundManager::singletonRef_s = NULL;
-    ALCdevice* SoundManager::device_s = NULL;
 
     /**
@@ -49,4 +48,5 @@
         singletonRef_s = this;
 
+        this->device_ = NULL;
         this->soundavailable_ = true;
         if(!alutInitWithoutContext(NULL,NULL))
@@ -57,11 +57,9 @@
         else
         {
-            if(SoundManager::device_s == NULL)
-            {
-                COUT(3) << "Sound: OpenAL: Open sound device..." << std::endl;
-                SoundManager::device_s = alcOpenDevice(NULL);
-            }
+            assert(this->device_ == NULL);
+            COUT(3) << "Sound: OpenAL: Open sound device..." << std::endl;
+            this->device_ = alcOpenDevice(NULL);
 
-            if(SoundManager::device_s == NULL)
+            if(this->device_ == NULL)
             {
                 COUT(2) << "Sound: OpenAL: Could not open sound device" << std::endl;
@@ -71,5 +69,5 @@
             {
                 COUT(3) << "Sound: OpenAL: Sound device opened" << std::endl;
-                this->context_ = alcCreateContext(SoundManager::device_s, NULL);
+                this->context_ = alcCreateContext(this->device_, NULL);
                 if(this->context_ == NULL)
                 {
@@ -99,5 +97,5 @@
 
         alcDestroyContext(this->context_);
-        alcCloseDevice(SoundManager::device_s);
+        alcCloseDevice(this->device_);
         alutExit();
     }
Index: code/trunk/src/orxonox/sound/SoundManager.h
===================================================================
--- code/trunk/src/orxonox/sound/SoundManager.h	(revision 3279)
+++ code/trunk/src/orxonox/sound/SoundManager.h	(revision 3280)
@@ -55,5 +55,5 @@
 
     private:
-        static ALCdevice* device_s;
+        ALCdevice* device_;
         ALCcontext* context_;
         std::list<SoundBase*> soundlist_;
Index: code/trunk/src/orxonox/tools/BillboardSet.cc
===================================================================
--- code/trunk/src/orxonox/tools/BillboardSet.cc	(revision 3279)
+++ code/trunk/src/orxonox/tools/BillboardSet.cc	(revision 3280)
@@ -38,5 +38,5 @@
 #include "util/Convert.h"
 #include "util/Math.h"
-#include "util/String.h"
+#include "util/StringUtils.h"
 #include "core/GameMode.h"
 
@@ -74,5 +74,5 @@
             if (GameMode::showsGraphics())
             {
-                this->billboardSet_ = scenemanager->createBillboardSet("Billboard" + convertToString(BillboardSet::billboardSetCounter_s++), count);
+                this->billboardSet_ = scenemanager->createBillboardSet("Billboard" + multi_cast<std::string>(BillboardSet::billboardSetCounter_s++), count);
                 this->billboardSet_->createBillboard(position);
                 this->billboardSet_->setMaterialName(file);
@@ -97,5 +97,5 @@
             if (GameMode::showsGraphics())
             {
-                this->billboardSet_ = scenemanager->createBillboardSet("Billboard" + convertToString(BillboardSet::billboardSetCounter_s++), count);
+                this->billboardSet_ = scenemanager->createBillboardSet("Billboard" + multi_cast<std::string>(BillboardSet::billboardSetCounter_s++), count);
                 this->billboardSet_->createBillboard(position, colour);
                 this->billboardSet_->setMaterialName(file);
Index: code/trunk/src/orxonox/tools/Mesh.cc
===================================================================
--- code/trunk/src/orxonox/tools/Mesh.cc	(revision 3279)
+++ code/trunk/src/orxonox/tools/Mesh.cc	(revision 3280)
@@ -36,5 +36,5 @@
 
 #include "util/Convert.h"
-#include "util/String.h"
+#include "util/StringUtils.h"
 #include "core/GameMode.h"
 
@@ -68,5 +68,5 @@
             try
             {
-                this->entity_ = this->scenemanager_->createEntity("Mesh" + convertToString(Mesh::meshCounter_s++), meshsource);
+                this->entity_ = this->scenemanager_->createEntity("Mesh" + multi_cast<std::string>(Mesh::meshCounter_s++), meshsource);
                 this->entity_->setCastShadows(this->bCastShadows_);
 
Index: code/trunk/src/orxonox/tools/ParticleInterface.cc
===================================================================
--- code/trunk/src/orxonox/tools/ParticleInterface.cc	(revision 3279)
+++ code/trunk/src/orxonox/tools/ParticleInterface.cc	(revision 3280)
@@ -51,5 +51,5 @@
     ParticleInterface* ParticleInterface::currentParticleInterface_s = 0;
 
-    ParticleInterface::ParticleInterface(Ogre::SceneManager* scenemanager, const std::string& templateName, LODParticle::LOD detaillevel)
+    ParticleInterface::ParticleInterface(Ogre::SceneManager* scenemanager, const std::string& templateName, LODParticle::Value detaillevel)
     {
         RegisterObject(ParticleInterface);
@@ -69,5 +69,5 @@
             try
             {
-                this->particleSystem_ = this->scenemanager_->createParticleSystem("particles" + getConvertedValue<unsigned int, std::string>(ParticleInterface::counter_s++), templateName);
+                this->particleSystem_ = this->scenemanager_->createParticleSystem("particles" + multi_cast<std::string>(ParticleInterface::counter_s++), templateName);
                 this->setSpeedFactor(1.0f);
             }
Index: code/trunk/src/orxonox/tools/ParticleInterface.h
===================================================================
--- code/trunk/src/orxonox/tools/ParticleInterface.h	(revision 3279)
+++ code/trunk/src/orxonox/tools/ParticleInterface.h	(revision 3280)
@@ -45,5 +45,5 @@
     {
         public:
-            ParticleInterface(Ogre::SceneManager* scenemanager, const std::string& templateName, LODParticle::LOD detaillevel);
+            ParticleInterface(Ogre::SceneManager* scenemanager, const std::string& templateName, LODParticle::Value detaillevel);
             virtual ~ParticleInterface();
 
Index: code/trunk/src/orxonox/tools/TextureGenerator.cc
===================================================================
--- code/trunk/src/orxonox/tools/TextureGenerator.cc	(revision 3279)
+++ code/trunk/src/orxonox/tools/TextureGenerator.cc	(revision 3280)
@@ -72,5 +72,5 @@
         if (it == colourMap.end())
         {
-            std::string materialName = textureName + "_Material_" + convertToString(materialCount_s++);
+            std::string materialName = textureName + "_Material_" + multi_cast<std::string>(materialCount_s++);
             Ogre::MaterialPtr material = (Ogre::MaterialPtr)Ogre::MaterialManager::getSingleton().create(materialName, "General");
             material->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
Index: code/trunk/src/util/CMakeLists.txt
===================================================================
--- code/trunk/src/util/CMakeLists.txt	(revision 3279)
+++ code/trunk/src/util/CMakeLists.txt	(revision 3280)
@@ -29,5 +29,5 @@
   SignalHandler.cc
   Sleep.cc
-  String.cc
+  StringUtils.cc
   SubString.cc
 )
Index: code/trunk/src/util/Convert.h
===================================================================
--- code/trunk/src/util/Convert.h	(revision 3279)
+++ code/trunk/src/util/Convert.h	(revision 3280)
@@ -43,5 +43,5 @@
 
 #include "Debug.h"
-#include "String.h"
+#include "StringUtils.h"
 #include "TemplateUtils.h"
 
@@ -316,18 +316,4 @@
     }
 
-    // convert to string Shortcut
-    template <class FromType>
-    FORCEINLINE std::string convertToString(FromType value)
-    {
-        return getConvertedValue<FromType, std::string>(value);
-    }
-
-    // convert from string Shortcut
-    template <class ToType>
-    FORCEINLINE ToType convertFromString(std::string str)
-    {
-        return getConvertedValue<std::string, ToType>(str);
-    }
-
     ////////////////////////////////
     // Special string conversions //
Index: code/trunk/src/util/Exception.cc
===================================================================
--- code/trunk/src/util/Exception.cc	(revision 3279)
+++ code/trunk/src/util/Exception.cc	(revision 3280)
@@ -64,5 +64,5 @@
             std::ostringstream fullDesc;
 
-            fullDesc << this->getTypeName() << "_EXCEPTION";
+            fullDesc << this->getTypeName() << "Exception";
 
             if (this->filename_ != "")
@@ -87,3 +87,9 @@
         return fullDescription_;
     }
+
+    //! Returns the error description
+    const char* Exception::what() const throw()
+    {
+        return getDescription().c_str();
+    }
 }
Index: code/trunk/src/util/Exception.h
===================================================================
--- code/trunk/src/util/Exception.h	(revision 3279)
+++ code/trunk/src/util/Exception.h	(revision 3280)
@@ -68,4 +68,5 @@
         //! Needed for compatibility with std::exception
         virtual ~Exception() throw() { }
+        const char* what() const throw();
 
         //! Returns a full description with type, line, file and function
@@ -81,7 +82,4 @@
         //! Returns the filename in which the exception occurred.
         virtual const std::string& getFilename()        const { return this->filename_; }
-
-        //! Returns a full description of the error.
-        const char* what() const throw() { return getFullDescription().c_str(); }
 
     protected:
@@ -152,5 +150,5 @@
     Exception description as string
 */
-#define ThrowException(type, description, ...) \
+#define ThrowException(type, description) \
     throw orxonox::exceptionThrowerHelper(type##Exception(static_cast<std::ostringstream&>(std::ostringstream().flush() << description).str(), __LINE__, __FILE__, __FUNCTIONNAME__))
 
Index: code/trunk/src/util/Math.h
===================================================================
--- code/trunk/src/util/Math.h	(revision 3279)
+++ code/trunk/src/util/Math.h	(revision 3280)
@@ -78,22 +78,4 @@
     {
         return (x >= 0) ? 1 : -1;
-    }
-
-    /**
-        @brief Returns the smaller of two values.
-    */
-    template <typename T>
-    inline T min(T a, T b)
-    {
-        return (a <= b) ? a : b;
-    }
-
-    /**
-        @brief Returns the greater of two values.
-    */
-    template <typename T>
-    inline T max(T a, T b)
-    {
-        return (a >= b) ? a : b;
     }
 
Index: code/trunk/src/util/MultiType.cc
===================================================================
--- code/trunk/src/util/MultiType.cc	(revision 3279)
+++ code/trunk/src/util/MultiType.cc	(revision 3280)
@@ -41,55 +41,55 @@
         @param type The type
     */
-    bool MultiType::convert(MT_Type type)
+    bool MultiType::convert(MT_Type::Value type)
     {
         switch (type)
         {
-            case MT_null:
+            case MT_Type::Null:
                 this->reset(); return true;
-            case MT_char:
+            case MT_Type::Char:
                 return this->convert<char>(); break;
-            case MT_uchar:
+            case MT_Type::UnsignedChar:
                 return this->convert<unsigned char>(); break;
-            case MT_short:
+            case MT_Type::Short:
                 return this->convert<short>(); break;
-            case MT_ushort:
+            case MT_Type::UnsignedShort:
                 return this->convert<unsigned short>(); break;
-            case MT_int:
+            case MT_Type::Int:
                 return this->convert<int>(); break;
-            case MT_uint:
+            case MT_Type::UnsignedInt:
                 return this->convert<unsigned int>(); break;
-            case MT_long:
+            case MT_Type::Long:
                 return this->convert<long>(); break;
-            case MT_ulong:
+            case MT_Type::UnsignedLong:
                 return this->convert<unsigned long>(); break;
-            case MT_longlong:
+            case MT_Type::LongLong:
                 return this->convert<long long>(); break;
-            case MT_ulonglong:
+            case MT_Type::UnsignedLongLong:
                 return this->convert<unsigned long long>(); break;
-            case MT_float:
+            case MT_Type::Float:
                 return this->convert<float>(); break;
-            case MT_double:
+            case MT_Type::Double:
                 return this->convert<double>(); break;
-            case MT_longdouble:
+            case MT_Type::LongDouble:
                 return this->convert<long double>(); break;
-            case MT_bool:
+            case MT_Type::Bool:
                 return this->convert<bool>(); break;
-            case MT_void:
+            case MT_Type::VoidPointer:
                 return this->convert<void*>(); break;
-            case MT_string:
+            case MT_Type::String:
                 return this->convert<std::string>(); break;
-            case MT_vector2:
+            case MT_Type::Vector2:
                 return this->convert<orxonox::Vector2>(); break;
-            case MT_vector3:
+            case MT_Type::Vector3:
                 return this->convert<orxonox::Vector3>(); break;
-            case MT_vector4:
+            case MT_Type::Vector4:
                 return this->convert<orxonox::Vector4>(); break;
-            case MT_colourvalue:
+            case MT_Type::ColourValue:
                 return this->convert<orxonox::ColourValue>(); break;
-            case MT_quaternion:
+            case MT_Type::Quaternion:
                 return this->convert<orxonox::Quaternion>(); break;
-            case MT_radian:
+            case MT_Type::Radian:
                 return this->convert<orxonox::Radian>(); break;
-            case MT_degree:
+            case MT_Type::Degree:
                 return this->convert<orxonox::Degree>(); break;
             default:
@@ -104,53 +104,53 @@
     std::string MultiType::getTypename() const
     {
-        MT_Type type = (this->value_) ? this->value_->type_ : MT_null;
+        MT_Type::Value type = (this->value_) ? this->value_->type_ : MT_Type::Null;
 
         switch (type)
         {
-            case MT_char:
+            case MT_Type::Char:
                 return "char"; break;
-            case MT_uchar:
+            case MT_Type::UnsignedChar:
                 return "unsigned char"; break;
-            case MT_short:
+            case MT_Type::Short:
                 return "short"; break;
-            case MT_ushort:
+            case MT_Type::UnsignedShort:
                 return "unsigned short"; break;
-            case MT_int:
+            case MT_Type::Int:
                 return "int"; break;
-            case MT_uint:
+            case MT_Type::UnsignedInt:
                 return "unsigned int"; break;
-            case MT_long:
+            case MT_Type::Long:
                 return "long"; break;
-            case MT_ulong:
+            case MT_Type::UnsignedLong:
                 return "unsigned long"; break;
-            case MT_longlong:
+            case MT_Type::LongLong:
                 return "long long"; break;
-            case MT_ulonglong:
+            case MT_Type::UnsignedLongLong:
                 return "unsigned long long"; break;
-            case MT_float:
+            case MT_Type::Float:
                 return "float"; break;
-            case MT_double:
+            case MT_Type::Double:
                 return "double"; break;
-            case MT_longdouble:
+            case MT_Type::LongDouble:
                 return "long double"; break;
-            case MT_bool:
+            case MT_Type::Bool:
                 return "bool"; break;
-            case MT_void:
+            case MT_Type::VoidPointer:
                 return "void*"; break;
-            case MT_string:
+            case MT_Type::String:
                 return "std::string"; break;
-            case MT_vector2:
+            case MT_Type::Vector2:
                 return "orxonox::Vector2"; break;
-            case MT_vector3:
+            case MT_Type::Vector3:
                 return "orxonox::Vector3"; break;
-            case MT_vector4:
+            case MT_Type::Vector4:
                 return "orxonox::Vector4"; break;
-            case MT_colourvalue:
+            case MT_Type::ColourValue:
                 return "orxonox::ColourValue"; break;
-            case MT_quaternion:
+            case MT_Type::Quaternion:
                 return "orxonox::Quaternion"; break;
-            case MT_radian:
+            case MT_Type::Radian:
                 return "orxonox::Radian"; break;
-            case MT_degree:
+            case MT_Type::Degree:
                 return "orxonox::Degree"; break;
             default:
@@ -159,50 +159,50 @@
     }
 
-    MultiType::operator char()                 const { return (this->value_) ? ((this->value_->type_ == MT_char       ) ? (static_cast<MT_Value<char>                *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
-    MultiType::operator unsigned char()        const { return (this->value_) ? ((this->value_->type_ == MT_uchar      ) ? (static_cast<MT_Value<unsigned char>       *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
-    MultiType::operator short()                const { return (this->value_) ? ((this->value_->type_ == MT_short      ) ? (static_cast<MT_Value<short>               *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
-    MultiType::operator unsigned short()       const { return (this->value_) ? ((this->value_->type_ == MT_ushort     ) ? (static_cast<MT_Value<unsigned short>      *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
-    MultiType::operator int()                  const { return (this->value_) ? ((this->value_->type_ == MT_int        ) ? (static_cast<MT_Value<int>                 *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
-    MultiType::operator unsigned int()         const { return (this->value_) ? ((this->value_->type_ == MT_uint       ) ? (static_cast<MT_Value<unsigned int>        *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
-    MultiType::operator long()                 const { return (this->value_) ? ((this->value_->type_ == MT_long       ) ? (static_cast<MT_Value<long>                *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
-    MultiType::operator unsigned long()        const { return (this->value_) ? ((this->value_->type_ == MT_ulong      ) ? (static_cast<MT_Value<unsigned long>       *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
-    MultiType::operator long long()            const { return (this->value_) ? ((this->value_->type_ == MT_longlong   ) ? (static_cast<MT_Value<long long>           *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
-    MultiType::operator unsigned long long()   const { return (this->value_) ? ((this->value_->type_ == MT_ulonglong  ) ? (static_cast<MT_Value<unsigned long long>  *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
-    MultiType::operator float()                const { return (this->value_) ? ((this->value_->type_ == MT_float      ) ? (static_cast<MT_Value<float>               *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
-    MultiType::operator double()               const { return (this->value_) ? ((this->value_->type_ == MT_double     ) ? (static_cast<MT_Value<double>              *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
-    MultiType::operator long double()          const { return (this->value_) ? ((this->value_->type_ == MT_longdouble ) ? (static_cast<MT_Value<long double>         *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
-    MultiType::operator bool()                 const { return (this->value_) ? ((this->value_->type_ == MT_bool       ) ? (static_cast<MT_Value<bool>                *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
-    MultiType::operator void*()                const { return (this->value_) ? ((this->value_->type_ == MT_void       ) ? (static_cast<MT_Value<void*>               *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
-    MultiType::operator std::string()          const { return (this->value_) ? ((this->value_->type_ == MT_string     ) ? (static_cast<MT_Value<std::string>         *>(this->value_))->value_ : (*this->value_)) : NilValue<std::string>();          } /** @brief Returns the current value, converted to the requested type. */
-    MultiType::operator orxonox::Vector2()     const { return (this->value_) ? ((this->value_->type_ == MT_vector2    ) ? (static_cast<MT_Value<orxonox::Vector2>    *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Vector2>();     } /** @brief Returns the current value, converted to the requested type. */
-    MultiType::operator orxonox::Vector3()     const { return (this->value_) ? ((this->value_->type_ == MT_vector3    ) ? (static_cast<MT_Value<orxonox::Vector3>    *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Vector3>();     } /** @brief Returns the current value, converted to the requested type. */
-    MultiType::operator orxonox::Vector4()     const { return (this->value_) ? ((this->value_->type_ == MT_vector4    ) ? (static_cast<MT_Value<orxonox::Vector4>    *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Vector4>();     } /** @brief Returns the current value, converted to the requested type. */
-    MultiType::operator orxonox::ColourValue() const { return (this->value_) ? ((this->value_->type_ == MT_colourvalue) ? (static_cast<MT_Value<orxonox::ColourValue>*>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::ColourValue>(); } /** @brief Returns the current value, converted to the requested type. */
-    MultiType::operator orxonox::Quaternion()  const { return (this->value_) ? ((this->value_->type_ == MT_quaternion ) ? (static_cast<MT_Value<orxonox::Quaternion> *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Quaternion>();  } /** @brief Returns the current value, converted to the requested type. */
-    MultiType::operator orxonox::Radian()      const { return (this->value_) ? ((this->value_->type_ == MT_radian     ) ? (static_cast<MT_Value<orxonox::Radian>     *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Radian>();      } /** @brief Returns the current value, converted to the requested type. */
-    MultiType::operator orxonox::Degree()      const { return (this->value_) ? ((this->value_->type_ == MT_degree     ) ? (static_cast<MT_Value<orxonox::Degree>     *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Degree>();      } /** @brief Returns the current value, converted to the requested type. */
-
-    template <> void MultiType::createNewValueContainer(const char& value)                 { this->value_ = new MT_Value<char>                (value, MT_char       ); } /** @brief Creates a new value container for the given type. */
-    template <> void MultiType::createNewValueContainer(const unsigned char& value)        { this->value_ = new MT_Value<unsigned char>       (value, MT_uchar      ); } /** @brief Creates a new value container for the given type. */
-    template <> void MultiType::createNewValueContainer(const short& value)                { this->value_ = new MT_Value<short>               (value, MT_short      ); } /** @brief Creates a new value container for the given type. */
-    template <> void MultiType::createNewValueContainer(const unsigned short& value)       { this->value_ = new MT_Value<unsigned short>      (value, MT_ushort     ); } /** @brief Creates a new value container for the given type. */
-    template <> void MultiType::createNewValueContainer(const int& value)                  { this->value_ = new MT_Value<int>                 (value, MT_int        ); } /** @brief Creates a new value container for the given type. */
-    template <> void MultiType::createNewValueContainer(const unsigned int& value)         { this->value_ = new MT_Value<unsigned int>        (value, MT_uint       ); } /** @brief Creates a new value container for the given type. */
-    template <> void MultiType::createNewValueContainer(const long& value)                 { this->value_ = new MT_Value<long>                (value, MT_long       ); } /** @brief Creates a new value container for the given type. */
-    template <> void MultiType::createNewValueContainer(const unsigned long& value)        { this->value_ = new MT_Value<unsigned long>       (value, MT_ulong      ); } /** @brief Creates a new value container for the given type. */
-    template <> void MultiType::createNewValueContainer(const long long& value)            { this->value_ = new MT_Value<long long>           (value, MT_longlong   ); } /** @brief Creates a new value container for the given type. */
-    template <> void MultiType::createNewValueContainer(const unsigned long long& value)   { this->value_ = new MT_Value<unsigned long long>  (value, MT_ulonglong  ); } /** @brief Creates a new value container for the given type. */
-    template <> void MultiType::createNewValueContainer(const float& value)                { this->value_ = new MT_Value<float>               (value, MT_float      ); } /** @brief Creates a new value container for the given type. */
-    template <> void MultiType::createNewValueContainer(const double& value)               { this->value_ = new MT_Value<double>              (value, MT_double     ); } /** @brief Creates a new value container for the given type. */
-    template <> void MultiType::createNewValueContainer(const long double& value)          { this->value_ = new MT_Value<long double>         (value, MT_longdouble ); } /** @brief Creates a new value container for the given type. */
-    template <> void MultiType::createNewValueContainer(const bool& value)                 { this->value_ = new MT_Value<bool>                (value, MT_bool       ); } /** @brief Creates a new value container for the given type. */
-    template <> void MultiType::createNewValueContainer(      void* const& value)          { this->value_ = new MT_Value<void*>               (value, MT_void       ); } /** @brief Creates a new value container for the given type. */
-    template <> void MultiType::createNewValueContainer(const std::string& value)          { this->value_ = new MT_Value<std::string>         (value, MT_string     ); } /** @brief Creates a new value container for the given type. */
-    template <> void MultiType::createNewValueContainer(const orxonox::Vector2& value)     { this->value_ = new MT_Value<orxonox::Vector2>    (value, MT_vector2    ); } /** @brief Creates a new value container for the given type. */
-    template <> void MultiType::createNewValueContainer(const orxonox::Vector3& value)     { this->value_ = new MT_Value<orxonox::Vector3>    (value, MT_vector3    ); } /** @brief Creates a new value container for the given type. */
-    template <> void MultiType::createNewValueContainer(const orxonox::Vector4& value)     { this->value_ = new MT_Value<orxonox::Vector4>    (value, MT_vector4    ); } /** @brief Creates a new value container for the given type. */
-    template <> void MultiType::createNewValueContainer(const orxonox::ColourValue& value) { this->value_ = new MT_Value<orxonox::ColourValue>(value, MT_colourvalue); } /** @brief Creates a new value container for the given type. */
-    template <> void MultiType::createNewValueContainer(const orxonox::Quaternion& value)  { this->value_ = new MT_Value<orxonox::Quaternion> (value, MT_quaternion ); } /** @brief Creates a new value container for the given type. */
-    template <> void MultiType::createNewValueContainer(const orxonox::Radian& value)      { this->value_ = new MT_Value<orxonox::Radian>     (value, MT_radian     ); } /** @brief Creates a new value container for the given type. */
-    template <> void MultiType::createNewValueContainer(const orxonox::Degree& value)      { this->value_ = new MT_Value<orxonox::Degree>     (value, MT_degree     ); } /** @brief Creates a new value container for the given type. */
+    MultiType::operator char()                 const { return (this->value_) ? ((this->value_->type_ == MT_Type::Char            ) ? (static_cast<MT_Value<char>                *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator unsigned char()        const { return (this->value_) ? ((this->value_->type_ == MT_Type::UnsignedChar    ) ? (static_cast<MT_Value<unsigned char>       *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator short()                const { return (this->value_) ? ((this->value_->type_ == MT_Type::Short           ) ? (static_cast<MT_Value<short>               *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator unsigned short()       const { return (this->value_) ? ((this->value_->type_ == MT_Type::UnsignedShort   ) ? (static_cast<MT_Value<unsigned short>      *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator int()                  const { return (this->value_) ? ((this->value_->type_ == MT_Type::Int             ) ? (static_cast<MT_Value<int>                 *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator unsigned int()         const { return (this->value_) ? ((this->value_->type_ == MT_Type::UnsignedInt     ) ? (static_cast<MT_Value<unsigned int>        *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator long()                 const { return (this->value_) ? ((this->value_->type_ == MT_Type::Long            ) ? (static_cast<MT_Value<long>                *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator unsigned long()        const { return (this->value_) ? ((this->value_->type_ == MT_Type::UnsignedLong    ) ? (static_cast<MT_Value<unsigned long>       *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator long long()            const { return (this->value_) ? ((this->value_->type_ == MT_Type::LongLong        ) ? (static_cast<MT_Value<long long>           *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator unsigned long long()   const { return (this->value_) ? ((this->value_->type_ == MT_Type::UnsignedLongLong) ? (static_cast<MT_Value<unsigned long long>  *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator float()                const { return (this->value_) ? ((this->value_->type_ == MT_Type::Float           ) ? (static_cast<MT_Value<float>               *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator double()               const { return (this->value_) ? ((this->value_->type_ == MT_Type::Double          ) ? (static_cast<MT_Value<double>              *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator long double()          const { return (this->value_) ? ((this->value_->type_ == MT_Type::LongDouble      ) ? (static_cast<MT_Value<long double>         *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator bool()                 const { return (this->value_) ? ((this->value_->type_ == MT_Type::Bool            ) ? (static_cast<MT_Value<bool>                *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator void*()                const { return (this->value_) ? ((this->value_->type_ == MT_Type::VoidPointer     ) ? (static_cast<MT_Value<void*>               *>(this->value_))->value_ : (*this->value_)) : 0;                      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator std::string()          const { return (this->value_) ? ((this->value_->type_ == MT_Type::String          ) ? (static_cast<MT_Value<std::string>         *>(this->value_))->value_ : (*this->value_)) : NilValue<std::string>();          } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator orxonox::Vector2()     const { return (this->value_) ? ((this->value_->type_ == MT_Type::Vector2         ) ? (static_cast<MT_Value<orxonox::Vector2>    *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Vector2>();     } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator orxonox::Vector3()     const { return (this->value_) ? ((this->value_->type_ == MT_Type::Vector3         ) ? (static_cast<MT_Value<orxonox::Vector3>    *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Vector3>();     } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator orxonox::Vector4()     const { return (this->value_) ? ((this->value_->type_ == MT_Type::Vector4         ) ? (static_cast<MT_Value<orxonox::Vector4>    *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Vector4>();     } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator orxonox::ColourValue() const { return (this->value_) ? ((this->value_->type_ == MT_Type::ColourValue     ) ? (static_cast<MT_Value<orxonox::ColourValue>*>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::ColourValue>(); } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator orxonox::Quaternion()  const { return (this->value_) ? ((this->value_->type_ == MT_Type::Quaternion      ) ? (static_cast<MT_Value<orxonox::Quaternion> *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Quaternion>();  } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator orxonox::Radian()      const { return (this->value_) ? ((this->value_->type_ == MT_Type::Radian          ) ? (static_cast<MT_Value<orxonox::Radian>     *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Radian>();      } /** @brief Returns the current value, converted to the requested type. */
+    MultiType::operator orxonox::Degree()      const { return (this->value_) ? ((this->value_->type_ == MT_Type::Degree          ) ? (static_cast<MT_Value<orxonox::Degree>     *>(this->value_))->value_ : (*this->value_)) : NilValue<orxonox::Degree>();      } /** @brief Returns the current value, converted to the requested type. */
+
+    template <> void MultiType::createNewValueContainer(const char& value)                 { this->value_ = new MT_Value<char>                (value, MT_Type::Char            ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const unsigned char& value)        { this->value_ = new MT_Value<unsigned char>       (value, MT_Type::UnsignedChar    ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const short& value)                { this->value_ = new MT_Value<short>               (value, MT_Type::Short           ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const unsigned short& value)       { this->value_ = new MT_Value<unsigned short>      (value, MT_Type::UnsignedShort   ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const int& value)                  { this->value_ = new MT_Value<int>                 (value, MT_Type::Int             ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const unsigned int& value)         { this->value_ = new MT_Value<unsigned int>        (value, MT_Type::UnsignedInt     ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const long& value)                 { this->value_ = new MT_Value<long>                (value, MT_Type::Long            ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const unsigned long& value)        { this->value_ = new MT_Value<unsigned long>       (value, MT_Type::UnsignedLong    ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const long long& value)            { this->value_ = new MT_Value<long long>           (value, MT_Type::LongLong        ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const unsigned long long& value)   { this->value_ = new MT_Value<unsigned long long>  (value, MT_Type::UnsignedLongLong); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const float& value)                { this->value_ = new MT_Value<float>               (value, MT_Type::Float           ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const double& value)               { this->value_ = new MT_Value<double>              (value, MT_Type::Double          ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const long double& value)          { this->value_ = new MT_Value<long double>         (value, MT_Type::LongDouble      ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const bool& value)                 { this->value_ = new MT_Value<bool>                (value, MT_Type::Bool            ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(      void* const& value)          { this->value_ = new MT_Value<void*>               (value, MT_Type::VoidPointer     ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const std::string& value)          { this->value_ = new MT_Value<std::string>         (value, MT_Type::String          ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const orxonox::Vector2& value)     { this->value_ = new MT_Value<orxonox::Vector2>    (value, MT_Type::Vector2         ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const orxonox::Vector3& value)     { this->value_ = new MT_Value<orxonox::Vector3>    (value, MT_Type::Vector3         ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const orxonox::Vector4& value)     { this->value_ = new MT_Value<orxonox::Vector4>    (value, MT_Type::Vector4         ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const orxonox::ColourValue& value) { this->value_ = new MT_Value<orxonox::ColourValue>(value, MT_Type::ColourValue     ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const orxonox::Quaternion& value)  { this->value_ = new MT_Value<orxonox::Quaternion> (value, MT_Type::Quaternion      ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const orxonox::Radian& value)      { this->value_ = new MT_Value<orxonox::Radian>     (value, MT_Type::Radian          ); } /** @brief Creates a new value container for the given type. */
+    template <> void MultiType::createNewValueContainer(const orxonox::Degree& value)      { this->value_ = new MT_Value<orxonox::Degree>     (value, MT_Type::Degree          ); } /** @brief Creates a new value container for the given type. */
 }
Index: code/trunk/src/util/MultiType.h
===================================================================
--- code/trunk/src/util/MultiType.h	(revision 3279)
+++ code/trunk/src/util/MultiType.h	(revision 3280)
@@ -84,31 +84,34 @@
         @brief Enum of all possible types of a MultiType.
     */
-    enum MT_Type
+    namespace MT_Type
     {
-        MT_null=0,
-        MT_char=1,
-        MT_uchar=2,
-        MT_short=3,
-        MT_ushort=4,
-        MT_int=5,
-        MT_uint=6,
-        MT_long=7,
-        MT_ulong=8,
-        MT_longlong=9,
-        MT_ulonglong=10,
-        MT_float=11,
-        MT_double=12,
-        MT_longdouble=13,
-        MT_bool=14,
-        MT_void=15,
-        MT_string=16,
-        MT_vector2=17,
-        MT_vector3=18,
-        MT_vector4=19,
-        MT_colourvalue=20,
-        MT_quaternion=21,
-        MT_radian=22,
-        MT_degree=23
-    };
+        enum Value
+        {
+            Null,
+            Char,
+            UnsignedChar,
+            Short,
+            UnsignedShort,
+            Int,
+            UnsignedInt,
+            Long,
+            UnsignedLong,
+            LongLong,
+            UnsignedLongLong,
+            Float,
+            Double,
+            LongDouble,
+            Bool,
+            VoidPointer,
+            String,
+            Vector2,
+            Vector3,
+            Vector4,
+            ColourValue,
+            Quaternion,
+            Radian,
+            Degree
+        };
+    }
 
     /**
@@ -142,5 +145,5 @@
         {
         public:
-            MT_ValueBase(MT_Type type) : type_(type), bHasDefaultValue_(false) {}
+            MT_ValueBase(MT_Type::Value type) : type_(type), bHasDefaultValue_(false) {}
             virtual ~MT_ValueBase() {}
 
@@ -151,5 +154,5 @@
 
             /** @brief Returns the type of the current value. */
-            const MT_Type& getType() const { return this->type_; }
+            const MT_Type::Value& getType() const { return this->type_; }
 
             /** @brief Checks whether the value is a default one. */
@@ -234,5 +237,5 @@
             virtual uint8_t getSize() const=0;
 
-            MT_Type type_;          //!< The type of the current value
+            MT_Type::Value type_;   //!< The type of the current value
             bool bHasDefaultValue_; //!< True if the last conversion wasn't successful
         };
@@ -265,5 +268,5 @@
             inline MultiType(const char* value)                 : value_(0) { this->setValue(std::string(value)); } /** @brief Constructor: Converts the char array to a std::string, assigns the value and sets the type. */
             inline MultiType(const MultiType& other)            : value_(0) { this->setValue(other); }              /** @brief Copyconstructor: Assigns value and type of the other MultiType. */
-            inline MultiType(MT_Type type)                      : value_(0) { this->setType(type); }                /** @brief Constructor: Sets the type, the next assignment will determine the value. */
+            inline MultiType(MT_Type::Value type)               : value_(0) { this->setType(type); }                /** @brief Constructor: Sets the type, the next assignment will determine the value. */
 
             /** @brief Destructor: Deletes the MT_Value. */
@@ -273,5 +276,5 @@
             template <typename V> inline const MultiType& operator=(V* value)               { this->setValue(value); return (*this); } /** @brief Assigns a pointer. */
             inline                       const MultiType& operator=(const MultiType& other) { this->setValue(other); return (*this); } /** @brief Assigns the value of the other MultiType and converts it to the current type of the MultiType. */
-            inline                       const MultiType& operator=(MT_Type type)           { this->setType(type);   return (*this); } /** @brief Resets the value and changes the type. */
+            inline                       const MultiType& operator=(MT_Type::Value type)    { this->setType(type);   return (*this); } /** @brief Resets the value and changes the type. */
 
             inline bool                                   setValue(const char& value);
@@ -312,7 +315,7 @@
             template <typename T> inline bool convert()                       { return this->setValue<T>((T)(*this));  } /** @brief Converts the current value to type T. */
             inline bool                       convert(const MultiType& other) { return this->convert(other.getType()); } /** @brief Converts the current value to the type of the other MultiType. */
-            bool                              convert(MT_Type type);
-
-            /** @brief Current content gets deleted. New type is MT_null */
+            bool                              convert(MT_Type::Value type);
+
+            /** @brief Current content gets deleted. New type is MT_Type::Null */
             inline void                       reset()                         { if (this->value_) delete this->value_; this->value_ = 0; }
             /** @brief Current content gets overridden with default zero value */
@@ -321,18 +324,18 @@
             template <typename T> inline void setType()                       { this->assignValue(typename TypeStripper<T>::RawType()); } /** @brief Resets the value and changes the internal type to T. */
             inline void                       setType(const MultiType& other) { this->setType(other.getType());                         } /** @brief Resets the value and changes the internal type to the type of the other MultiType. */
-            inline void                       setType(MT_Type type)           { this->reset(); this->convert(type); this->resetValue(); } /** @brief Resets the value and changes the internal type to the given type. */
+            inline void                       setType(MT_Type::Value type)    { this->reset(); this->convert(type); this->resetValue(); } /** @brief Resets the value and changes the internal type to the given type. */
 
             /** @brief Returns the current type. */
-            inline MT_Type                    getType()                 const { return (this->value_) ? this->value_->type_ : MT_null; }
+            inline MT_Type::Value             getType()                   const { return (this->value_) ? this->value_->type_ : MT_Type::Null; }
             /** @brief Returns true if the current type equals the given type. */
-            inline bool                       isType(MT_Type type)      const { return (this->value_) ? (this->value_->type_ == type) : (type == MT_null); }
+            inline bool                       isType(MT_Type::Value type) const { return (this->value_) ? (this->value_->type_ == type) : (type == MT_Type::Null); }
             /** @brief Returns true if the current type is T. */
-            template <typename T> inline bool isType()                  const { return false; } // Only works for specialized values - see below
-            std::string                       getTypename()             const;
+            template <typename T> inline bool isType()                    const { return false; } // Only works for specialized values - see below
+            std::string                       getTypename()               const;
             
             /** @brief Saves the value of the MT to a bytestream (pointed at by mem) and increases mem pointer by size of MT */
-            inline void                       exportData(uint8_t*& mem) const { assert(sizeof(MT_Type)<=8); *(uint8_t*)(mem) = this->getType(); mem+=sizeof(uint8_t); this->value_->exportData(mem); }
+            inline void                       exportData(uint8_t*& mem) const { assert(sizeof(MT_Type::Value)<=8); *(uint8_t*)(mem) = this->getType(); mem+=sizeof(uint8_t); this->value_->exportData(mem); }
             /** @brief Loads the value of the MT from a bytestream (pointed at by mem) and increases mem pointer by size of MT */
-            inline void                       importData(uint8_t*& mem) { assert(sizeof(MT_Type)<=8); this->setType(static_cast<MT_Type>(*(uint8_t*)mem)); mem+=sizeof(uint8_t); this->value_->importData(mem); }
+            inline void                       importData(uint8_t*& mem) { assert(sizeof(MT_Type::Value)<=8); this->setType(static_cast<MT_Type::Value>(*(uint8_t*)mem)); mem+=sizeof(uint8_t); this->value_->importData(mem); }
             /** @brief Saves the value of the MT to a bytestream and increases pointer to bytestream by size of MT */
             inline uint8_t*&                  operator << (uint8_t*& mem) { importData(mem); return mem; }
@@ -420,27 +423,27 @@
 
         private:
-            inline bool assignValue(const char& value)                 { if (this->value_ && this->value_->type_ == MT_char)        { return this->value_->setValue(value); } else { this->changeValueContainer<char>(value);                 return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
-            inline bool assignValue(const unsigned char& value)        { if (this->value_ && this->value_->type_ == MT_uchar)       { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned char>(value);        return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
-            inline bool assignValue(const short& value)                { if (this->value_ && this->value_->type_ == MT_short)       { return this->value_->setValue(value); } else { this->changeValueContainer<short>(value);                return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
-            inline bool assignValue(const unsigned short& value)       { if (this->value_ && this->value_->type_ == MT_ushort)      { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned short>(value);       return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
-            inline bool assignValue(const int& value)                  { if (this->value_ && this->value_->type_ == MT_int)         { return this->value_->setValue(value); } else { this->changeValueContainer<int>(value);                  return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
-            inline bool assignValue(const unsigned int& value)         { if (this->value_ && this->value_->type_ == MT_uint)        { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned int>(value);         return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
-            inline bool assignValue(const long& value)                 { if (this->value_ && this->value_->type_ == MT_long)        { return this->value_->setValue(value); } else { this->changeValueContainer<long>(value);                 return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
-            inline bool assignValue(const unsigned long& value)        { if (this->value_ && this->value_->type_ == MT_ulong)       { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned long>(value);        return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
-            inline bool assignValue(const long long& value)            { if (this->value_ && this->value_->type_ == MT_longlong)    { return this->value_->setValue(value); } else { this->changeValueContainer<long long>(value);            return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
-            inline bool assignValue(const unsigned long long& value)   { if (this->value_ && this->value_->type_ == MT_ulonglong)   { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned long long>(value);   return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
-            inline bool assignValue(const float& value)                { if (this->value_ && this->value_->type_ == MT_float)       { return this->value_->setValue(value); } else { this->changeValueContainer<float>(value);                return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
-            inline bool assignValue(const double& value)               { if (this->value_ && this->value_->type_ == MT_double)      { return this->value_->setValue(value); } else { this->changeValueContainer<double>(value);               return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
-            inline bool assignValue(const long double& value)          { if (this->value_ && this->value_->type_ == MT_longdouble)  { return this->value_->setValue(value); } else { this->changeValueContainer<long double>(value);          return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
-            inline bool assignValue(const bool& value)                 { if (this->value_ && this->value_->type_ == MT_bool)        { return this->value_->setValue(value); } else { this->changeValueContainer<bool>(value);                 return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
-            inline bool assignValue(      void* const& value)          { if (this->value_ && this->value_->type_ == MT_void)        { return this->value_->setValue(value); } else { this->changeValueContainer<void*>(value);                return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
-            inline bool assignValue(const std::string& value)          { if (this->value_ && this->value_->type_ == MT_string)      { return this->value_->setValue(value); } else { this->changeValueContainer<std::string>(value);          return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
-            inline bool assignValue(const orxonox::Vector2& value)     { if (this->value_ && this->value_->type_ == MT_vector2)     { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector2>(value);     return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
-            inline bool assignValue(const orxonox::Vector3& value)     { if (this->value_ && this->value_->type_ == MT_vector3)     { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector3>(value);     return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
-            inline bool assignValue(const orxonox::Vector4& value)     { if (this->value_ && this->value_->type_ == MT_vector4)     { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector4>(value);     return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
-            inline bool assignValue(const orxonox::ColourValue& value) { if (this->value_ && this->value_->type_ == MT_colourvalue) { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::ColourValue>(value); return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
-            inline bool assignValue(const orxonox::Quaternion& value)  { if (this->value_ && this->value_->type_ == MT_quaternion)  { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Quaternion>(value);  return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
-            inline bool assignValue(const orxonox::Radian& value)      { if (this->value_ && this->value_->type_ == MT_radian)      { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Radian>(value);      return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
-            inline bool assignValue(const orxonox::Degree& value)      { if (this->value_ && this->value_->type_ == MT_degree)      { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Degree>(value);      return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const char& value)                 { if (this->value_ && this->value_->type_ == MT_Type::Char)             { return this->value_->setValue(value); } else { this->changeValueContainer<char>(value);                 return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const unsigned char& value)        { if (this->value_ && this->value_->type_ == MT_Type::UnsignedChar)     { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned char>(value);        return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const short& value)                { if (this->value_ && this->value_->type_ == MT_Type::Short)            { return this->value_->setValue(value); } else { this->changeValueContainer<short>(value);                return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const unsigned short& value)       { if (this->value_ && this->value_->type_ == MT_Type::UnsignedShort)    { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned short>(value);       return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const int& value)                  { if (this->value_ && this->value_->type_ == MT_Type::Int)              { return this->value_->setValue(value); } else { this->changeValueContainer<int>(value);                  return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const unsigned int& value)         { if (this->value_ && this->value_->type_ == MT_Type::UnsignedInt)      { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned int>(value);         return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const long& value)                 { if (this->value_ && this->value_->type_ == MT_Type::Long)             { return this->value_->setValue(value); } else { this->changeValueContainer<long>(value);                 return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const unsigned long& value)        { if (this->value_ && this->value_->type_ == MT_Type::UnsignedLong)     { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned long>(value);        return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const long long& value)            { if (this->value_ && this->value_->type_ == MT_Type::LongLong)         { return this->value_->setValue(value); } else { this->changeValueContainer<long long>(value);            return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const unsigned long long& value)   { if (this->value_ && this->value_->type_ == MT_Type::UnsignedLongLong) { return this->value_->setValue(value); } else { this->changeValueContainer<unsigned long long>(value);   return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const float& value)                { if (this->value_ && this->value_->type_ == MT_Type::Float)            { return this->value_->setValue(value); } else { this->changeValueContainer<float>(value);                return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const double& value)               { if (this->value_ && this->value_->type_ == MT_Type::Double)           { return this->value_->setValue(value); } else { this->changeValueContainer<double>(value);               return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const long double& value)          { if (this->value_ && this->value_->type_ == MT_Type::LongDouble)       { return this->value_->setValue(value); } else { this->changeValueContainer<long double>(value);          return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const bool& value)                 { if (this->value_ && this->value_->type_ == MT_Type::Bool)             { return this->value_->setValue(value); } else { this->changeValueContainer<bool>(value);                 return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(      void* const& value)          { if (this->value_ && this->value_->type_ == MT_Type::VoidPointer)      { return this->value_->setValue(value); } else { this->changeValueContainer<void*>(value);                return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const std::string& value)          { if (this->value_ && this->value_->type_ == MT_Type::String)           { return this->value_->setValue(value); } else { this->changeValueContainer<std::string>(value);          return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const orxonox::Vector2& value)     { if (this->value_ && this->value_->type_ == MT_Type::Vector2)          { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector2>(value);     return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const orxonox::Vector3& value)     { if (this->value_ && this->value_->type_ == MT_Type::Vector3)          { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector3>(value);     return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const orxonox::Vector4& value)     { if (this->value_ && this->value_->type_ == MT_Type::Vector4)          { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Vector4>(value);     return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const orxonox::ColourValue& value) { if (this->value_ && this->value_->type_ == MT_Type::ColourValue)      { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::ColourValue>(value); return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const orxonox::Quaternion& value)  { if (this->value_ && this->value_->type_ == MT_Type::Quaternion)       { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Quaternion>(value);  return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const orxonox::Radian& value)      { if (this->value_ && this->value_->type_ == MT_Type::Radian)           { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Radian>(value);      return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
+            inline bool assignValue(const orxonox::Degree& value)      { if (this->value_ && this->value_->type_ == MT_Type::Degree)           { return this->value_->setValue(value); } else { this->changeValueContainer<orxonox::Degree>(value);      return true; } } /** @brief Assigns a new value by changing type and creating a new container. */
 
             /** @brief Changes the value container. */
@@ -455,27 +458,27 @@
     _UtilExport inline std::ostream& operator<<(std::ostream& outstream, const MultiType& mt) { if (mt.value_) { mt.value_->toString(outstream); } return outstream; }
 
-    template <> inline bool MultiType::isType<char>()                 const { return (this->value_ && this->value_->type_ == MT_char);        } /** @brief Returns true if the current type equals the given type. */
-    template <> inline bool MultiType::isType<unsigned char>()        const { return (this->value_ && this->value_->type_ == MT_uchar);       } /** @brief Returns true if the current type equals the given type. */
-    template <> inline bool MultiType::isType<short>()                const { return (this->value_ && this->value_->type_ == MT_short);       } /** @brief Returns true if the current type equals the given type. */
-    template <> inline bool MultiType::isType<unsigned short>()       const { return (this->value_ && this->value_->type_ == MT_ushort);      } /** @brief Returns true if the current type equals the given type. */
-    template <> inline bool MultiType::isType<int>()                  const { return (this->value_ && this->value_->type_ == MT_int);         } /** @brief Returns true if the current type equals the given type. */
-    template <> inline bool MultiType::isType<unsigned int>()         const { return (this->value_ && this->value_->type_ == MT_uint);        } /** @brief Returns true if the current type equals the given type. */
-    template <> inline bool MultiType::isType<long>()                 const { return (this->value_ && this->value_->type_ == MT_long);        } /** @brief Returns true if the current type equals the given type. */
-    template <> inline bool MultiType::isType<unsigned long>()        const { return (this->value_ && this->value_->type_ == MT_ulong);       } /** @brief Returns true if the current type equals the given type. */
-    template <> inline bool MultiType::isType<long long>()            const { return (this->value_ && this->value_->type_ == MT_longlong);    } /** @brief Returns true if the current type equals the given type. */
-    template <> inline bool MultiType::isType<unsigned long long>()   const { return (this->value_ && this->value_->type_ == MT_ulonglong);   } /** @brief Returns true if the current type equals the given type. */
-    template <> inline bool MultiType::isType<float>()                const { return (this->value_ && this->value_->type_ == MT_float);       } /** @brief Returns true if the current type equals the given type. */
-    template <> inline bool MultiType::isType<double>()               const { return (this->value_ && this->value_->type_ == MT_double);      } /** @brief Returns true if the current type equals the given type. */
-    template <> inline bool MultiType::isType<long double>()          const { return (this->value_ && this->value_->type_ == MT_longdouble);  } /** @brief Returns true if the current type equals the given type. */
-    template <> inline bool MultiType::isType<bool>()                 const { return (this->value_ && this->value_->type_ == MT_bool);        } /** @brief Returns true if the current type equals the given type. */
-    template <> inline bool MultiType::isType<void*>()                const { return (this->value_ && this->value_->type_ == MT_void);        } /** @brief Returns true if the current type equals the given type. */
-    template <> inline bool MultiType::isType<std::string>()          const { return (this->value_ && this->value_->type_ == MT_string);      } /** @brief Returns true if the current type equals the given type. */
-    template <> inline bool MultiType::isType<orxonox::Vector2>()     const { return (this->value_ && this->value_->type_ == MT_vector2);     } /** @brief Returns true if the current type equals the given type. */
-    template <> inline bool MultiType::isType<orxonox::Vector3>()     const { return (this->value_ && this->value_->type_ == MT_vector3);     } /** @brief Returns true if the current type equals the given type. */
-    template <> inline bool MultiType::isType<orxonox::Vector4>()     const { return (this->value_ && this->value_->type_ == MT_vector4);     } /** @brief Returns true if the current type equals the given type. */
-    template <> inline bool MultiType::isType<orxonox::ColourValue>() const { return (this->value_ && this->value_->type_ == MT_colourvalue); } /** @brief Returns true if the current type equals the given type. */
-    template <> inline bool MultiType::isType<orxonox::Quaternion>()  const { return (this->value_ && this->value_->type_ == MT_quaternion);  } /** @brief Returns true if the current type equals the given type. */
-    template <> inline bool MultiType::isType<orxonox::Radian>()      const { return (this->value_ && this->value_->type_ == MT_radian);      } /** @brief Returns true if the current type equals the given type. */
-    template <> inline bool MultiType::isType<orxonox::Degree>()      const { return (this->value_ && this->value_->type_ == MT_degree);      } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<char>()                 const { return (this->value_ && this->value_->type_ == MT_Type::Char);             } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<unsigned char>()        const { return (this->value_ && this->value_->type_ == MT_Type::UnsignedChar);     } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<short>()                const { return (this->value_ && this->value_->type_ == MT_Type::Short);            } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<unsigned short>()       const { return (this->value_ && this->value_->type_ == MT_Type::UnsignedShort);    } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<int>()                  const { return (this->value_ && this->value_->type_ == MT_Type::Int);              } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<unsigned int>()         const { return (this->value_ && this->value_->type_ == MT_Type::UnsignedInt);      } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<long>()                 const { return (this->value_ && this->value_->type_ == MT_Type::Long);             } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<unsigned long>()        const { return (this->value_ && this->value_->type_ == MT_Type::UnsignedLong);     } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<long long>()            const { return (this->value_ && this->value_->type_ == MT_Type::LongLong);         } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<unsigned long long>()   const { return (this->value_ && this->value_->type_ == MT_Type::UnsignedLongLong); } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<float>()                const { return (this->value_ && this->value_->type_ == MT_Type::Float);            } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<double>()               const { return (this->value_ && this->value_->type_ == MT_Type::Double);           } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<long double>()          const { return (this->value_ && this->value_->type_ == MT_Type::LongDouble);       } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<bool>()                 const { return (this->value_ && this->value_->type_ == MT_Type::Bool);             } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<void*>()                const { return (this->value_ && this->value_->type_ == MT_Type::VoidPointer);      } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<std::string>()          const { return (this->value_ && this->value_->type_ == MT_Type::String);           } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<orxonox::Vector2>()     const { return (this->value_ && this->value_->type_ == MT_Type::Vector2);          } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<orxonox::Vector3>()     const { return (this->value_ && this->value_->type_ == MT_Type::Vector3);          } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<orxonox::Vector4>()     const { return (this->value_ && this->value_->type_ == MT_Type::Vector4);          } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<orxonox::ColourValue>() const { return (this->value_ && this->value_->type_ == MT_Type::ColourValue);      } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<orxonox::Quaternion>()  const { return (this->value_ && this->value_->type_ == MT_Type::Quaternion);       } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<orxonox::Radian>()      const { return (this->value_ && this->value_->type_ == MT_Type::Radian);           } /** @brief Returns true if the current type equals the given type. */
+    template <> inline bool MultiType::isType<orxonox::Degree>()      const { return (this->value_ && this->value_->type_ == MT_Type::Degree);           } /** @brief Returns true if the current type equals the given type. */
 
     // Specialization to avoid ambiguities with the conversion operator
Index: code/trunk/src/util/MultiTypeValue.h
===================================================================
--- code/trunk/src/util/MultiTypeValue.h	(revision 3279)
+++ code/trunk/src/util/MultiTypeValue.h	(revision 3280)
@@ -54,5 +54,5 @@
     public:
         /** @brief Constructor: Assigns the value and the type identifier. */
-        MT_Value(const T& value, MT_Type type) : MT_ValueBase(type), value_(value) {}
+        MT_Value(const T& value, MT_Type::Value type) : MT_ValueBase(type), value_(value) {}
 
         /** @brief Creates a copy of itself. */
@@ -139,12 +139,12 @@
         inline operator bool()                 const { return getConvertedValue<T, bool>                (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
         inline operator void*()                const { return getConvertedValue<T, void*>               (this->value_, 0); }     /** @brief Returns the current value, converted to the requested type. */
-        inline operator std::string()          const { return getConvertedValue<T, std::string>         (this->value_, zeroise<std::string         >()); } /** @brief Returns the current value, converted to the requested type. */
-        inline operator orxonox::Vector2()     const { return getConvertedValue<T, orxonox::Vector2>    (this->value_, zeroise<orxonox::Vector2    >()); } /** @brief Returns the current value, converted to the requested type. */
-        inline operator orxonox::Vector3()     const { return getConvertedValue<T, orxonox::Vector3>    (this->value_, zeroise<orxonox::Vector3    >()); } /** @brief Returns the current value, converted to the requested type. */
-        inline operator orxonox::Vector4()     const { return getConvertedValue<T, orxonox::Vector4>    (this->value_, zeroise<orxonox::Vector4    >()); } /** @brief Returns the current value, converted to the requested type. */
-        inline operator orxonox::ColourValue() const { return getConvertedValue<T, orxonox::ColourValue>(this->value_, zeroise<orxonox::ColourValue>()); } /** @brief Returns the current value, converted to the requested type. */
-        inline operator orxonox::Quaternion()  const { return getConvertedValue<T, orxonox::Quaternion> (this->value_, zeroise<orxonox::Quaternion >()); } /** @brief Returns the current value, converted to the requested type. */
-        inline operator orxonox::Radian()      const { return getConvertedValue<T, orxonox::Radian>     (this->value_, zeroise<orxonox::Radian     >()); } /** @brief Returns the current value, converted to the requested type. */
-        inline operator orxonox::Degree()      const { return getConvertedValue<T, orxonox::Degree>     (this->value_, zeroise<orxonox::Degree     >()); } /** @brief Returns the current value, converted to the requested type. */
+        inline operator std::string()          const { return getConvertedValue<T, std::string>         (this->value_, NilValue<std::string         >()); } /** @brief Returns the current value, converted to the requested type. */
+        inline operator orxonox::Vector2()     const { return getConvertedValue<T, orxonox::Vector2>    (this->value_, NilValue<orxonox::Vector2    >()); } /** @brief Returns the current value, converted to the requested type. */
+        inline operator orxonox::Vector3()     const { return getConvertedValue<T, orxonox::Vector3>    (this->value_, NilValue<orxonox::Vector3    >()); } /** @brief Returns the current value, converted to the requested type. */
+        inline operator orxonox::Vector4()     const { return getConvertedValue<T, orxonox::Vector4>    (this->value_, NilValue<orxonox::Vector4    >()); } /** @brief Returns the current value, converted to the requested type. */
+        inline operator orxonox::ColourValue() const { return getConvertedValue<T, orxonox::ColourValue>(this->value_, NilValue<orxonox::ColourValue>()); } /** @brief Returns the current value, converted to the requested type. */
+        inline operator orxonox::Quaternion()  const { return getConvertedValue<T, orxonox::Quaternion> (this->value_, NilValue<orxonox::Quaternion >()); } /** @brief Returns the current value, converted to the requested type. */
+        inline operator orxonox::Radian()      const { return getConvertedValue<T, orxonox::Radian>     (this->value_, NilValue<orxonox::Radian     >()); } /** @brief Returns the current value, converted to the requested type. */
+        inline operator orxonox::Degree()      const { return getConvertedValue<T, orxonox::Degree>     (this->value_, NilValue<orxonox::Degree     >()); } /** @brief Returns the current value, converted to the requested type. */
 
         /** @brief Puts the current value on the stream */
Index: code/trunk/src/util/RefToValue.h
===================================================================
--- code/trunk/src/util/RefToValue.h	(revision 3280)
+++ code/trunk/src/util/RefToValue.h	(revision 3280)
@@ -0,0 +1,70 @@
+////////////////////////////////////////////////////////////////////////////////
+// The Loki Library
+// Copyright (c) 2006 Richard Sposato
+// Copyright (c) 2006 Peter Kümmel
+// Permission to use, copy, modify, distribute and sell this software for any 
+//     purpose is hereby granted without fee, provided that the above copyright 
+//     notice appear in all copies and that both that copyright notice and this 
+//     permission notice appear in supporting documentation.
+// The authors make no representations about the 
+//     suitability of this software for any purpose. It is provided "as is" 
+//     without express or implied warranty.
+////////////////////////////////////////////////////////////////////////////////
+#ifndef LOKI_REFTOVALUE_INC_
+#define LOKI_REFTOVALUE_INC_
+
+// $Id: RefToValue.h 751 2006-10-17 19:50:37Z syntheticpp $
+
+
+namespace Loki
+{
+
+    ////////////////////////////////////////////////////////////////////////////////
+    ///  \class RefToValue
+    ///
+    ///  \ingroup SmartPointerGroup 
+    ///  Transports a reference as a value
+    ///  Serves to implement the Colvin/Gibbons trick for SmartPtr/ScopeGuard
+    ////////////////////////////////////////////////////////////////////////////////
+
+    template <class T>
+    class RefToValue
+    {   
+    public:
+    
+        RefToValue(T& ref) : ref_(ref) 
+        {}
+
+        RefToValue(const RefToValue& rhs) : ref_(rhs.ref_)
+        {}
+
+        operator T& () const 
+        {
+            return ref_;
+        }
+
+    private:
+        // Disable - not implemented
+        RefToValue();
+        RefToValue& operator=(const RefToValue&);
+        
+        T& ref_;
+    };
+
+
+    ////////////////////////////////////////////////////////////////////////////////
+    ///  \ingroup ExceptionGroup 
+    ///  RefToValue creator.
+    ////////////////////////////////////////////////////////////////////////////////
+
+    template <class T>
+    inline RefToValue<T> ByRef(T& t)
+    {
+        return RefToValue<T>(t);
+    }    
+    
+}
+
+
+#endif // end file guardian
+
Index: code/trunk/src/util/ScopeGuard.h
===================================================================
--- code/trunk/src/util/ScopeGuard.h	(revision 3280)
+++ code/trunk/src/util/ScopeGuard.h	(revision 3280)
@@ -0,0 +1,666 @@
+////////////////////////////////////////////////////////////////////////////////
+// The Loki Library
+// Copyright (c) 2000 Andrei Alexandrescu
+// Copyright (c) 2000 Petru Marginean
+// Copyright (c) 2005 Joshua Lehrer
+//
+// Permission to use, copy, modify, distribute and sell this software for any 
+//     purpose is hereby granted without fee, provided that the above copyright 
+//     notice appear in all copies and that both that copyright notice and this 
+//     permission notice appear in supporting documentation.
+// The author makes no representations about the 
+//     suitability of this software for any purpose. It is provided "as is" 
+//     without express or implied warranty.
+////////////////////////////////////////////////////////////////////////////////
+#ifndef LOKI_SCOPEGUARD_INC_
+#define LOKI_SCOPEGUARD_INC_
+
+// $Id: ScopeGuard.h 799 2006-12-20 00:37:13Z rich_sposato $
+
+
+#include "RefToValue.h"
+
+/// \defgroup ExceptionGroup Exception-safe code
+
+namespace Loki
+{
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ScopeGuardImplBase
+    /// \ingroup ExceptionGroup
+    ///
+    /// Base class used by all ScopeGuard implementations.  All commonly used
+    /// functions are in this class (e.g. - Dismiss and SafeExecute).
+    ///
+    /// See Andrei's and Petru Marginean's CUJ article
+    /// http://www.cuj.com/documents/s=8000/cujcexp1812alexandr/alexandr.htm
+    ///
+    /// Changes to the original code by Joshua Lehrer:
+    /// http://www.lehrerfamily.com/scopeguard.html
+    ////////////////////////////////////////////////////////////////
+
+    class ScopeGuardImplBase
+    {
+        /// Copy-assignment operator is not implemented and private.
+        ScopeGuardImplBase& operator =(const ScopeGuardImplBase&);
+
+    protected:
+
+        ~ScopeGuardImplBase()
+        {}
+
+        /// Copy-constructor takes over responsibility from other ScopeGuard.
+        ScopeGuardImplBase(const ScopeGuardImplBase& other) throw() 
+            : dismissed_(other.dismissed_)
+        {
+            other.Dismiss();
+        }
+
+        template <typename J>
+        static void SafeExecute(J& j) throw() 
+        {
+            if (!j.dismissed_)
+                try
+                {
+                    j.Execute();
+                }
+                catch(...)
+                {}
+        }
+        
+        mutable bool dismissed_;
+
+    public:
+        ScopeGuardImplBase() throw() : dismissed_(false) 
+        {}
+
+        void Dismiss() const throw() 
+        {
+            dismissed_ = true;
+        }
+    };
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \typedef typedef const ScopeGuardImplBase& ScopeGuard
+    /// \ingroup ExceptionGroup
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    typedef const ScopeGuardImplBase& ScopeGuard;
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ScopeGuardImpl0
+    /// \ingroup ExceptionGroup
+    ///
+    /// Implementation class for a standalone function or class static function
+    /// with no parameters.  ScopeGuard ignores any value returned from the
+    /// call within the Execute function.
+    ///
+    /// This class has a single standalone helper function, MakeGuard which
+    /// creates and returns a ScopeGuard.
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    template <typename F>
+    class ScopeGuardImpl0 : public ScopeGuardImplBase
+    {
+    public:
+        static ScopeGuardImpl0<F> MakeGuard(F fun)
+        {
+            return ScopeGuardImpl0<F>(fun);
+        }
+
+        ~ScopeGuardImpl0() throw() 
+        {
+            SafeExecute(*this);
+        }
+
+        void Execute() 
+        {
+            fun_();
+        }
+
+    protected:
+        ScopeGuardImpl0(F fun) : fun_(fun) 
+        {}
+
+        F fun_;
+    };
+
+    template <typename F> 
+    inline ScopeGuardImpl0<F> MakeGuard(F fun)
+    {
+        return ScopeGuardImpl0<F>::MakeGuard(fun);
+    }
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ScopeGuardImpl1
+    /// \ingroup ExceptionGroup
+    ///
+    /// Implementation class for a standalone function or class static function
+    /// with one parameter.  Each parameter is copied by value - use
+    /// ::Loki::ByRef if you must use a reference instead.  ScopeGuard ignores
+    /// any value returned from the call within the Execute function.
+    ///
+    /// This class has a single standalone helper function, MakeGuard which
+    /// creates and returns a ScopeGuard.
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    template <typename F, typename P1>
+    class ScopeGuardImpl1 : public ScopeGuardImplBase
+    {
+    public:
+        static ScopeGuardImpl1<F, P1> MakeGuard(F fun, P1 p1)
+        {
+            return ScopeGuardImpl1<F, P1>(fun, p1);
+        }
+
+        ~ScopeGuardImpl1() throw() 
+        {
+            SafeExecute(*this);
+        }
+
+        void Execute()
+        {
+            fun_(p1_);
+        }
+
+    protected:
+        ScopeGuardImpl1(F fun, P1 p1) : fun_(fun), p1_(p1) 
+        {}
+
+        F fun_;
+        const P1 p1_;
+    };
+
+    template <typename F, typename P1> 
+    inline ScopeGuardImpl1<F, P1> MakeGuard(F fun, P1 p1)
+    {
+        return ScopeGuardImpl1<F, P1>::MakeGuard(fun, p1);
+    }
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ScopeGuardImpl2
+    /// \ingroup ExceptionGroup
+    ///
+    /// Implementation class for a standalone function or class static function
+    /// with two parameters.  Each parameter is copied by value - use
+    /// ::Loki::ByRef if you must use a reference instead.  ScopeGuard ignores
+    /// any value returned from the call within the Execute function.
+    ///
+    /// This class has a single standalone helper function, MakeGuard which
+    /// creates and returns a ScopeGuard.
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    template <typename F, typename P1, typename P2>
+    class ScopeGuardImpl2: public ScopeGuardImplBase
+    {
+    public:
+        static ScopeGuardImpl2<F, P1, P2> MakeGuard(F fun, P1 p1, P2 p2)
+        {
+            return ScopeGuardImpl2<F, P1, P2>(fun, p1, p2);
+        }
+
+        ~ScopeGuardImpl2() throw() 
+        {
+            SafeExecute(*this);
+        }
+
+        void Execute()
+        {
+            fun_(p1_, p2_);
+        }
+
+    protected:
+        ScopeGuardImpl2(F fun, P1 p1, P2 p2) : fun_(fun), p1_(p1), p2_(p2) 
+        {}
+
+        F fun_;
+        const P1 p1_;
+        const P2 p2_;
+    };
+
+    template <typename F, typename P1, typename P2>
+    inline ScopeGuardImpl2<F, P1, P2> MakeGuard(F fun, P1 p1, P2 p2)
+    {
+        return ScopeGuardImpl2<F, P1, P2>::MakeGuard(fun, p1, p2);
+    }
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ScopeGuardImpl3
+    /// \ingroup ExceptionGroup
+    ///
+    /// Implementation class for a standalone function or class static function
+    /// with three parameters.  Each parameter is copied by value - use
+    /// ::Loki::ByRef if you must use a reference instead.  ScopeGuard ignores
+    /// any value returned from the call within the Execute function.
+    ///
+    /// This class has a single standalone helper function, MakeGuard which
+    /// creates and returns a ScopeGuard.
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    template <typename F, typename P1, typename P2, typename P3>
+    class ScopeGuardImpl3 : public ScopeGuardImplBase
+    {
+    public:
+        static ScopeGuardImpl3<F, P1, P2, P3> MakeGuard(F fun, P1 p1, P2 p2, P3 p3)
+        {
+            return ScopeGuardImpl3<F, P1, P2, P3>(fun, p1, p2, p3);
+        }
+
+        ~ScopeGuardImpl3() throw() 
+        {
+            SafeExecute(*this);
+        }
+
+        void Execute()
+        {
+            fun_(p1_, p2_, p3_);
+        }
+
+    protected:
+        ScopeGuardImpl3(F fun, P1 p1, P2 p2, P3 p3) : fun_(fun), p1_(p1), p2_(p2), p3_(p3) 
+        {}
+
+        F fun_;
+        const P1 p1_;
+        const P2 p2_;
+        const P3 p3_;
+    };
+
+    template <typename F, typename P1, typename P2, typename P3>
+    inline ScopeGuardImpl3<F, P1, P2, P3> MakeGuard(F fun, P1 p1, P2 p2, P3 p3)
+    {
+        return ScopeGuardImpl3<F, P1, P2, P3>::MakeGuard(fun, p1, p2, p3);
+    }
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ScopeGuardImpl4
+    /// \ingroup ExceptionGroup
+    ///
+    /// Implementation class for a standalone function or class static function
+    /// with four parameters.  Each parameter is copied by value - use
+    /// ::Loki::ByRef if you must use a reference instead.  ScopeGuard ignores
+    /// any value returned from the call within the Execute function.
+    ///
+    /// This class has a single standalone helper function, MakeGuard which
+    /// creates and returns a ScopeGuard.
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    template < typename F, typename P1, typename P2, typename P3, typename P4 >
+    class ScopeGuardImpl4 : public ScopeGuardImplBase
+    {
+    public:
+        static ScopeGuardImpl4< F, P1, P2, P3, P4 > MakeGuard(
+            F fun, P1 p1, P2 p2, P3 p3, P4 p4 )
+        {
+            return ScopeGuardImpl4< F, P1, P2, P3, P4 >( fun, p1, p2, p3, p4 );
+        }
+
+        ~ScopeGuardImpl4() throw() 
+        {
+            SafeExecute( *this );
+        }
+
+        void Execute()
+        {
+            fun_( p1_, p2_, p3_, p4_ );
+        }
+
+    protected:
+        ScopeGuardImpl4( F fun, P1 p1, P2 p2, P3 p3, P4 p4 ) :
+             fun_( fun ), p1_( p1 ), p2_( p2 ), p3_( p3 ), p4_( p4 )
+        {}
+
+        F fun_;
+        const P1 p1_;
+        const P2 p2_;
+        const P3 p3_;
+        const P4 p4_;
+    };
+
+    template < typename F, typename P1, typename P2, typename P3, typename P4 >
+    inline ScopeGuardImpl4< F, P1, P2, P3, P4 > MakeGuard( F fun, P1 p1, P2 p2, P3 p3, P4 p4 )
+    {
+        return ScopeGuardImpl4< F, P1, P2, P3, P4 >::MakeGuard( fun, p1, p2, p3, p4 );
+    }
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ScopeGuardImpl5
+    /// \ingroup ExceptionGroup
+    ///
+    /// Implementation class for a standalone function or class static function
+    /// with five parameters.  Each parameter is copied by value - use
+    /// ::Loki::ByRef if you must use a reference instead.  ScopeGuard ignores
+    /// any value returned from the call within the Execute function.
+    ///
+    /// This class has a single standalone helper function, MakeGuard which
+    /// creates and returns a ScopeGuard.
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    template < typename F, typename P1, typename P2, typename P3, typename P4, typename P5 >
+    class ScopeGuardImpl5 : public ScopeGuardImplBase
+    {
+    public:
+        static ScopeGuardImpl5< F, P1, P2, P3, P4, P5 > MakeGuard(
+            F fun, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5 )
+        {
+            return ScopeGuardImpl5< F, P1, P2, P3, P4, P5 >( fun, p1, p2, p3, p4, p5 );
+        }
+
+        ~ScopeGuardImpl5() throw() 
+        {
+            SafeExecute( *this );
+        }
+
+        void Execute()
+        {
+            fun_( p1_, p2_, p3_, p4_, p5_ );
+        }
+
+    protected:
+        ScopeGuardImpl5( F fun, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5 ) :
+             fun_( fun ), p1_( p1 ), p2_( p2 ), p3_( p3 ), p4_( p4 ), p5_( p5 )
+        {}
+
+        F fun_;
+        const P1 p1_;
+        const P2 p2_;
+        const P3 p3_;
+        const P4 p4_;
+        const P5 p5_;
+    };
+
+    template < typename F, typename P1, typename P2, typename P3, typename P4, typename P5 >
+    inline ScopeGuardImpl5< F, P1, P2, P3, P4, P5 > MakeGuard( F fun, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5 )
+    {
+        return ScopeGuardImpl5< F, P1, P2, P3, P4, P5 >::MakeGuard( fun, p1, p2, p3, p4, p5 );
+    }
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ObjScopeGuardImpl0
+    /// \ingroup ExceptionGroup
+    ///
+    /// Implementation class for a class per-instance member function with no
+    /// parameters.  ScopeGuard ignores any value returned from the call within
+    /// the Execute function.
+    ///
+    /// This class has 3 standalone helper functions which create a ScopeGuard.
+    /// One is MakeObjGuard, which is deprecated but provided for older code.
+    /// The other two are MakeGuard overloads, one which takes a pointer to an
+    /// object, and the other which takes a reference.
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    template <class Obj, typename MemFun>
+    class ObjScopeGuardImpl0 : public ScopeGuardImplBase
+    {
+    public:
+        static ObjScopeGuardImpl0<Obj, MemFun> MakeObjGuard(Obj& obj, MemFun memFun)
+        {
+            return ObjScopeGuardImpl0<Obj, MemFun>(obj, memFun);
+        }
+
+        ~ObjScopeGuardImpl0() throw() 
+        {
+            SafeExecute(*this);
+        }
+
+        void Execute() 
+        {
+            (obj_.*memFun_)();
+        }
+
+    protected:
+        ObjScopeGuardImpl0(Obj& obj, MemFun memFun) : obj_(obj), memFun_(memFun) 
+        {}
+
+        Obj& obj_;
+        MemFun memFun_;
+    };
+
+    template <class Obj, typename MemFun>
+    inline ObjScopeGuardImpl0<Obj, MemFun> MakeObjGuard(Obj& obj, MemFun memFun)
+    {
+        return ObjScopeGuardImpl0<Obj, MemFun>::MakeObjGuard(obj, memFun);
+    }
+
+    template <typename Ret, class Obj1, class Obj2>
+    inline ObjScopeGuardImpl0<Obj1,Ret(Obj2::*)()> MakeGuard(Ret(Obj2::*memFun)(), Obj1 &obj) 
+    {
+      return ObjScopeGuardImpl0<Obj1,Ret(Obj2::*)()>::MakeObjGuard(obj,memFun);
+    }
+
+    template <typename Ret, class Obj1, class Obj2>
+    inline ObjScopeGuardImpl0<Obj1,Ret(Obj2::*)()> MakeGuard(Ret(Obj2::*memFun)(), Obj1 *obj) 
+    {
+      return ObjScopeGuardImpl0<Obj1,Ret(Obj2::*)()>::MakeObjGuard(*obj,memFun);
+    }
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ObjScopeGuardImpl1
+    /// \ingroup ExceptionGroup
+    ///
+    /// Implementation class for a class per-instance member function with one
+    /// parameter.  The parameter is copied by value - use ::Loki::ByRef if you
+    /// must use a reference instead.  ScopeGuard ignores any value returned
+    /// from the call within the Execute function.
+    ///
+    /// This class has 3 standalone helper functions which create a ScopeGuard.
+    /// One is MakeObjGuard, which is deprecated but provided for older code.
+    /// The other two are MakeGuard overloads, one which takes a pointer to an
+    /// object, and the other which takes a reference.
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    template <class Obj, typename MemFun, typename P1>
+    class ObjScopeGuardImpl1 : public ScopeGuardImplBase
+    {
+    public:
+        static ObjScopeGuardImpl1<Obj, MemFun, P1> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1)
+        {
+            return ObjScopeGuardImpl1<Obj, MemFun, P1>(obj, memFun, p1);
+        }
+
+        ~ObjScopeGuardImpl1() throw() 
+        {
+            SafeExecute(*this);
+        }
+
+        void Execute() 
+        {
+            (obj_.*memFun_)(p1_);
+        }
+
+    protected:
+        ObjScopeGuardImpl1(Obj& obj, MemFun memFun, P1 p1) : obj_(obj), memFun_(memFun), p1_(p1) 
+        {}
+        
+        Obj& obj_;
+        MemFun memFun_;
+        const P1 p1_;
+    };
+
+    template <class Obj, typename MemFun, typename P1>
+    inline ObjScopeGuardImpl1<Obj, MemFun, P1> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1)
+    {
+        return ObjScopeGuardImpl1<Obj, MemFun, P1>::MakeObjGuard(obj, memFun, p1);
+    }
+
+    template <typename Ret, class Obj1, class Obj2, typename P1a, typename P1b>
+    inline ObjScopeGuardImpl1<Obj1,Ret(Obj2::*)(P1a),P1b> MakeGuard(Ret(Obj2::*memFun)(P1a), Obj1 &obj, P1b p1) 
+    {
+      return ObjScopeGuardImpl1<Obj1,Ret(Obj2::*)(P1a),P1b>::MakeObjGuard(obj,memFun,p1);
+    }
+
+    template <typename Ret, class Obj1, class Obj2, typename P1a, typename P1b>
+    inline ObjScopeGuardImpl1<Obj1,Ret(Obj2::*)(P1a),P1b> MakeGuard(Ret(Obj2::*memFun)(P1a), Obj1 *obj, P1b p1) 
+    {
+      return ObjScopeGuardImpl1<Obj1,Ret(Obj2::*)(P1a),P1b>::MakeObjGuard(*obj,memFun,p1);
+    }
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ObjScopeGuardImpl2
+    /// \ingroup ExceptionGroup
+    ///
+    /// Implementation class for a class per-instance member function with two
+    /// parameters.  Each parameter is copied by value - use ::Loki::ByRef if you
+    /// must use a reference instead.  ScopeGuard ignores any value returned
+    /// from the call within the Execute function.
+    ///
+    /// This class has 3 standalone helper functions which create a ScopeGuard.
+    /// One is MakeObjGuard, which is deprecated but provided for older code.
+    /// The other two are MakeGuard overloads, one which takes a pointer to an
+    /// object, and the other which takes a reference.
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    template <class Obj, typename MemFun, typename P1, typename P2>
+    class ObjScopeGuardImpl2 : public ScopeGuardImplBase
+    {
+    public:
+        static ObjScopeGuardImpl2<Obj, MemFun, P1, P2> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2)
+        {
+            return ObjScopeGuardImpl2<Obj, MemFun, P1, P2>(obj, memFun, p1, p2);
+        }
+
+        ~ObjScopeGuardImpl2() throw() 
+        {
+            SafeExecute(*this);
+        }
+
+        void Execute() 
+        {
+            (obj_.*memFun_)(p1_, p2_);
+        }
+
+    protected:
+        ObjScopeGuardImpl2(Obj& obj, MemFun memFun, P1 p1, P2 p2) : obj_(obj), memFun_(memFun), p1_(p1), p2_(p2) 
+        {}
+
+        Obj& obj_;
+        MemFun memFun_;
+        const P1 p1_;
+        const P2 p2_;
+    };
+
+    template <class Obj, typename MemFun, typename P1, typename P2>
+    inline ObjScopeGuardImpl2<Obj, MemFun, P1, P2> MakeObjGuard(Obj& obj, MemFun memFun, P1 p1, P2 p2)
+    {
+        return ObjScopeGuardImpl2<Obj, MemFun, P1, P2>::MakeObjGuard(obj, memFun, p1, p2);
+    }
+
+    template <typename Ret, class Obj1, class Obj2, typename P1a, typename P1b, typename P2a, typename P2b>
+    inline ObjScopeGuardImpl2<Obj1,Ret(Obj2::*)(P1a,P2a),P1b,P2b> MakeGuard(Ret(Obj2::*memFun)(P1a,P2a), Obj1 &obj, P1b p1, P2b p2) 
+    {
+      return ObjScopeGuardImpl2<Obj1,Ret(Obj2::*)(P1a,P2a),P1b,P2b>::MakeObjGuard(obj,memFun,p1,p2);
+    }
+
+    template <typename Ret, class Obj1, class Obj2, typename P1a, typename P1b, typename P2a, typename P2b>
+    inline ObjScopeGuardImpl2<Obj1,Ret(Obj2::*)(P1a,P2a),P1b,P2b> MakeGuard(Ret(Obj2::*memFun)(P1a,P2a), Obj1 *obj, P1b p1, P2b p2) 
+    {
+      return ObjScopeGuardImpl2<Obj1,Ret(Obj2::*)(P1a,P2a),P1b,P2b>::MakeObjGuard(*obj,memFun,p1,p2);
+    }
+
+    ////////////////////////////////////////////////////////////////
+    ///
+    /// \class ObjScopeGuardImpl3
+    /// \ingroup ExceptionGroup
+    ///
+    /// Implementation class for a class per-instance member function with three
+    /// parameters.  Each parameter is copied by value - use ::Loki::ByRef if you
+    /// must use a reference instead.  ScopeGuard ignores any value returned
+    /// from the call within the Execute function.
+    ///
+    /// This class has 3 standalone helper functions which create a ScopeGuard.
+    /// One is MakeObjGuard, which is deprecated but provided for older code.
+    /// The other two are MakeGuard overloads, one which takes a pointer to an
+    /// object, and the other which takes a reference.
+    ///
+    ////////////////////////////////////////////////////////////////
+
+    template < class Obj, typename MemFun, typename P1, typename P2, typename P3 >
+    class ObjScopeGuardImpl3 : public ScopeGuardImplBase
+    {
+    public:
+        static ObjScopeGuardImpl3< Obj, MemFun, P1, P2, P3 > MakeObjGuard(
+            Obj & obj, MemFun memFun, P1 p1, P2 p2, P3 p3 )
+        {
+            return ObjScopeGuardImpl3< Obj, MemFun, P1, P2, P3 >( obj, memFun, p1, p2, p3 );
+        }
+
+        ~ObjScopeGuardImpl3() throw() 
+        {
+            SafeExecute( *this );
+        }
+
+        void Execute() 
+        {
+            ( obj_.*memFun_ )( p1_, p2_, p3_ );
+        }
+
+    protected:
+        ObjScopeGuardImpl3( Obj & obj, MemFun memFun, P1 p1, P2 p2, P3 p3 ) :
+             obj_( obj ), memFun_( memFun ), p1_( p1 ), p2_( p2 ), p3_( p3 )
+        {}
+
+        Obj& obj_;
+        MemFun memFun_;
+        const P1 p1_;
+        const P2 p2_;
+        const P3 p3_;
+    };
+
+    template < class Obj, typename MemFun, typename P1, typename P2, typename P3 >
+    inline ObjScopeGuardImpl3< Obj, MemFun, P1, P2, P3 > MakeObjGuard(
+        Obj & obj, MemFun memFun, P1 p1, P2 p2, P3 p3 )
+    {
+        return ObjScopeGuardImpl3< Obj, MemFun, P1, P2, P3 >::MakeObjGuard(
+            obj, memFun, p1, p2, p3 );
+    }
+
+    template < typename Ret, class Obj1, class Obj2, typename P1a, typename P1b,
+        typename P2a, typename P2b, typename P3a, typename P3b >
+    inline ObjScopeGuardImpl3< Obj1, Ret( Obj2::* )( P1a, P2a, P3a ), P1b, P2b, P3b >
+        MakeGuard( Ret( Obj2::*memFun )( P1a, P2a, P3a ), Obj1 & obj, P1b p1, P2b p2, P3b p3 )
+    {
+      return ObjScopeGuardImpl3< Obj1, Ret( Obj2::* )( P1a, P2a, P3a ), P1b, P2b, P3b >
+          ::MakeObjGuard( obj, memFun, p1, p2, p3 );
+    }
+
+    template < typename Ret, class Obj1, class Obj2, typename P1a, typename P1b,
+        typename P2a, typename P2b, typename P3a, typename P3b >
+    inline ObjScopeGuardImpl3< Obj1, Ret( Obj2::* )( P1a, P2a, P3a ), P1b, P2b, P3b >
+        MakeGuard( Ret( Obj2::*memFun )( P1a, P2a, P3a ), Obj1 * obj, P1b p1, P2b p2, P3b p3 )
+    {
+      return ObjScopeGuardImpl3< Obj1, Ret( Obj2::* )( P1a, P2a, P3a ), P1b, P2b, P3b >
+          ::MakeObjGuard( *obj, memFun, p1, p2, p3 );
+    }
+
+} // namespace Loki
+
+#define LOKI_CONCATENATE_DIRECT(s1, s2)  s1##s2
+#define LOKI_CONCATENATE(s1, s2)         LOKI_CONCATENATE_DIRECT(s1, s2)
+#define LOKI_ANONYMOUS_VARIABLE(str)     LOKI_CONCATENATE(str, __LINE__)
+
+#define LOKI_ON_BLOCK_EXIT      ::Loki::ScopeGuard LOKI_ANONYMOUS_VARIABLE(scopeGuard) = ::Loki::MakeGuard
+#define LOKI_ON_BLOCK_EXIT_OBJ  ::Loki::ScopeGuard LOKI_ANONYMOUS_VARIABLE(scopeGuard) = ::Loki::MakeObjGuard
+
+#endif // end file guardian
+
Index: code/trunk/src/util/String.cc
===================================================================
--- code/trunk/src/util/String.cc	(revision 3279)
+++ 	(revision )
@@ -1,492 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      Benjamin Grauer
- *
- */
-
-/**
-    @file
-    @brief Implementation of several string manipulation functions.
-*/
-
-#include "String.h"
-
-#include <cctype>
-#include "Convert.h"
-#include "Math.h"
-
-namespace orxonox
-{
-    std::string BLANKSTRING("");
-
-    std::string getUniqueNumberString()
-    {
-        return convertToString(getUniqueNumber());
-    }
-
-    /**
-        @brief Removes all whitespaces from a string.
-        @param str The string to strip
-    */
-    void strip(std::string* str)
-    {
-        size_t pos;
-        while ((pos = (*str).find(" ")) < (*str).length())
-            (*str).erase(pos, 1);
-        while ((pos = (*str).find("\t")) < (*str).length())
-            (*str).erase(pos, 1);
-        while ((pos = (*str).find("\n")) < (*str).length())
-            (*str).erase(pos, 1);
-    }
-
-    /**
-        @brief Returns a copy of a string without whitespaces.
-        @param str The string to strip
-        @return The stripped line
-    */
-    std::string getStripped(const std::string& str)
-    {
-        std::string output = std::string(str);
-        strip(&output);
-        return output;
-    }
-
-    /**
-        @brief Returns a copy of a string without trailing whitespaces.
-        @param str The string
-        @return The modified copy
-    */
-    std::string removeTrailingWhitespaces(const std::string& str)
-    {
-        size_t pos1 = 0;
-        int pos2 = (int)(str.size() - 1);
-        for (; pos1 < str.size() && (str[pos1] == ' ' || str[pos1] == '\t' || str[pos1] == '\n'); pos1++);
-        for (; pos2 > 0         && (str[pos2] == ' ' || str[pos2] == '\t' || str[pos2] == '\n'); pos2--);
-        return str.substr(pos1, pos2 - pos1 + 1);
-    }
-
-    /**
-        @brief Returns the position of the next quote in the string, starting with start.
-        @param str The string
-        @param start The startposition
-        @return The position of the next quote (std::string::npos if there is no next quote)
-    */
-    size_t getNextQuote(const std::string& str, size_t start)
-    {
-        size_t quote = start - 1;
-
-        while ((quote = str.find('\"', quote + 1)) != std::string::npos)
-        {
-            size_t backslash = quote;
-            size_t numbackslashes = 0;
-            for (; backslash > 0; backslash--, numbackslashes++)
-                if (str[backslash - 1] != '\\')
-                    break;
-
-            if (numbackslashes % 2 == 0)
-                break;
-        }
-
-        return quote;
-    }
-
-    /**
-        @brief Returns true if pos is between two quotes.
-        @param str The string
-        @param pos The position to check
-        @return True if pos is between two quotes
-    */
-    bool isBetweenQuotes(const std::string& str, size_t pos)
-    {
-        if (pos == std::string::npos)
-            return false;
-
-        size_t quotecount = 0;
-        size_t quote = (size_t)-1;
-        while ((quote = getNextQuote(str, quote + 1)) < pos)
-        {
-            if (quote == pos)
-                return false;
-            quotecount++;
-        }
-
-        if (quote == std::string::npos)
-            return false;
-
-        return ((quotecount % 2) == 1);
-    }
-
-    /**
-        @brief Returns true if the string contains something like '..."between quotes"...'.
-        @param The string
-        @return True if there is something between quotes
-    */
-    bool hasStringBetweenQuotes(const std::string& str)
-    {
-        size_t pos1 = getNextQuote(str, 0);
-        size_t pos2 = getNextQuote(str, pos1 + 1);
-        return (pos1 != std::string::npos && pos2 != std::string::npos && pos2 > pos1 + 1);
-    }
-
-    /**
-        @brief If the string contains something like '..."between quotes"...' then 'between quotes' gets returned (without quotes).
-        @param The string
-        @param The string between the quotes
-    */
-    std::string getStringBetweenQuotes(const std::string& str)
-    {
-        size_t pos1 = getNextQuote(str, 0);
-        size_t pos2 = getNextQuote(str, pos1 + 1);
-        if (pos1 != std::string::npos && pos2 != std::string::npos)
-            return str.substr(pos1, pos2 - pos1 + 1);
-        else
-            return "";
-    }
-
-    /**
-        @brief Removes enclosing quotes if available (including whitespaces at the outside of the quotes).
-        @brief str The string to strip
-        @return The string with removed quotes
-    */
-    std::string stripEnclosingQuotes(const std::string& str)
-    {
-        size_t start = std::string::npos;
-        size_t end = 0;
-
-        for (size_t pos = 0; (pos < str.size()) && (pos < std::string::npos); pos++)
-        {
-            if (str[pos] == '"')
-            {
-                start = pos;
-                break;
-            }
-
-            if ((str[pos] != ' ') && (str[pos] != '\t') && (str[pos] != '\n'))
-                return str;
-        }
-
-        for (size_t pos = str.size() - 1; pos < std::string::npos; pos--)
-        {
-            if (str[pos] == '"')
-            {
-                end = pos;
-                break;
-            }
-
-            if ((str[pos] != ' ') && (str[pos] != '\t') && (str[pos] != '\n'))
-                return str;
-        }
-
-        if ((start != std::string::npos) && (end != 0))
-            return str.substr(start + 1, end - start - 1);
-        else
-            return str;
-    }
-
-    /**
-        @brief Removes enclosing {braces} (braces must be exactly on the beginning and the end of the string).
-        @param str The string to strip
-        @return The striped string
-    */
-    std::string stripEnclosingBraces(const std::string& str)
-    {
-        std::string output = str;
-
-        while (output.size() >= 2 && output[0] == '{' && output[output.size() - 1] == '}')
-            output = output.substr(1, output.size() - 2);
-
-        return output;
-    }
-
-    /**
-        @brief Determines if a string is a comment (starts with a comment-symbol).
-        @param str The string to check
-        @return True = it's a comment
-
-        A comment is defined by a leading '#', '%', ';' or '//'.
-    */
-    bool isComment(const std::string& str)
-    {
-        // Strip the line, whitespaces are disturbing
-        std::string teststring = getStripped(str);
-
-        // There are four possible comment-symbols:
-        //  1) #comment in script-language style
-        //  2) %comment in matlab style
-        //  3) ;comment in unreal tournament config-file style
-        //  4) //comment in code style
-        if (teststring.size() >= 2)
-        {
-            if (teststring[0] == '#' || teststring[0] == '%' || teststring[0] == ';' || (teststring[0] == '/' && teststring[1] == '/'))
-                return true;
-        }
-        else if (teststring.size() == 1)
-        {
-            if (teststring[0] == '#' || teststring[0] == '%' || teststring[0] == ';')
-                return true;
-        }
-
-        return false;
-    }
-
-    /**
-        @brief Determines if a string is empty (contains only whitespaces).
-        @param str The string to check
-        @return True = it's empty
-    */
-    bool isEmpty(const std::string& str)
-    {
-        std::string temp = getStripped(str);
-        return ((temp == "") || (temp.size() == 0));
-    }
-
-    /**
-        @brief Determines if a string contains only numbers and maximal one '.'.
-        @param str The string to check
-        @return True = it's a number
-    */
-    bool isNumeric(const std::string& str)
-    {
-        bool foundPoint = false;
-
-        for (std::string::const_iterator it = str.begin(); it != str.end(); ++it)
-        {
-            if (((*it) < '0' || (*it) > '9'))
-            {
-                if ((*it) != '.' && !foundPoint)
-                    foundPoint = true;
-                else
-                    return false;
-            }
-        }
-
-        return true;
-    }
-
-    /**
-        @brief Adds backslashes to the given string which makes special chars visible. Existing slashes will be doubled.
-        @param str The string to manipulate
-        @return The string with added slashes
-    */
-    std::string addSlashes(const std::string& str)
-    {
-        std::string output = str;
-
-        for (size_t pos = 0; (pos = output.find('\\', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\\\"); }
-        for (size_t pos = 0; (pos = output.find('\n', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\n"); }
-        for (size_t pos = 0; (pos = output.find('\t', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\t"); }
-        for (size_t pos = 0; (pos = output.find('\v', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\v"); }
-        for (size_t pos = 0; (pos = output.find('\b', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\b"); }
-        for (size_t pos = 0; (pos = output.find('\r', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\r"); }
-        for (size_t pos = 0; (pos = output.find('\f', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\f"); }
-        for (size_t pos = 0; (pos = output.find('\a', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\a"); }
-        for (size_t pos = 0; (pos = output.find('"', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\\""); }
-        for (size_t pos = 0; (pos = output.find('\0', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\0"); }
-
-        return output;
-    }
-
-    /**
-        @brief Removes backslashes from the given string. Double backslashes are interpreted as one backslash.
-        @param str The string to manipulate
-        @return The string with removed slashes
-    */
-    std::string removeSlashes(const std::string& str)
-    {
-        if (str.size() <= 1)
-            return str;
-
-        std::string output = "";
-        for (size_t pos = 0; pos < str.size() - 1; )
-        {
-            if (str[pos] == '\\')
-            {
-                if (str[pos + 1] == '\\') { output += '\\'; pos += 2; continue; }
-                else if (str[pos + 1] == 'n') { output += '\n'; pos += 2; continue; }
-                else if (str[pos + 1] == 't') { output += '\t'; pos += 2; continue; }
-                else if (str[pos + 1] == 'v') { output += '\v'; pos += 2; continue; }
-                else if (str[pos + 1] == 'b') { output += '\b'; pos += 2; continue; }
-                else if (str[pos + 1] == 'r') { output += '\r'; pos += 2; continue; }
-                else if (str[pos + 1] == 'f') { output += '\f'; pos += 2; continue; }
-                else if (str[pos + 1] == 'a') { output += '\a'; pos += 2; continue; }
-                else if (str[pos + 1] == '"') { output += '"'; pos += 2; continue; }
-                else if (str[pos + 1] == '0') { output += '\0'; pos += 2; continue; }
-            }
-            output += str[pos];
-            pos++;
-            if (pos == str.size() - 1)
-                output += str[pos];
-        }
-
-        return output;
-    }
-
-    /**
-        @brief Replaces each char between A and Z with its lowercase equivalent.
-        @param str The string to convert
-    */
-    void lowercase(std::string* str)
-    {
-        for (size_t i = 0; i < str->size(); ++i)
-        {
-            (*str)[i] = (char)tolower((*str)[i]);
-        }
-    }
-
-    /**
-        @brief Returns a copy of the given string without uppercase chars.
-        @param str The string
-        @return The copy
-    */
-    std::string getLowercase(const std::string& str)
-    {
-        std::string output = std::string(str);
-        lowercase(&output);
-        return output;
-    }
-
-    /**
-        @brief Replaces each char between a and z with its uppercase equivalent.
-        @param str The string to convert
-    */
-    void uppercase(std::string* str)
-    {
-        for (size_t i = 0; i < str->size(); ++i)
-        {
-            (*str)[i] = (char)toupper((*str)[i]);
-        }
-    }
-
-    /**
-        @brief Returns a copy of the given string without lowercase chars.
-        @param str The string
-        @return The copy
-    */
-    std::string getUppercase(const std::string& str)
-    {
-        std::string output = std::string(str);
-        uppercase(&output);
-        return output;
-    }
-
-    /**
-        @brief Compares two strings ignoring different casing.
-        @param s1 First string
-        @param s2 Second string
-    */
-    int nocaseCmp(const std::string& s1, const std::string& s2)
-    {
-        std::string::const_iterator it1=s1.begin();
-        std::string::const_iterator it2=s2.begin();
-
-        //stop when either string's end has been reached
-        while ( (it1!=s1.end()) && (it2!=s2.end()) )
-        {
-            if(::toupper(*it1) != ::toupper(*it2)) //letters differ?
-                // return -1 to indicate smaller than, 1 otherwise
-                return (::toupper(*it1)  < ::toupper(*it2)) ? -1 : 1;
-            //proceed to the next character in each string
-            ++it1;
-            ++it2;
-        }
-        size_t size1=s1.size(), size2=s2.size();// cache lengths
-        //return -1,0 or 1 according to strings' lengths
-        if (size1==size2)
-            return 0;
-        return (size1<size2) ? -1 : 1;
-    }
-
-
-    /**
-        @brief Compares the first 'len' chars of two strings ignoring different casing.
-        @param s1 First string
-        @param s2 Second string
-        @param len Maximal number of chars to compare
-    */
-    int nocaseCmp(const std::string& s1, const std::string& s2, size_t len)
-    {
-        if (len == 0)
-            return 0;
-        std::string::const_iterator it1=s1.begin();
-        std::string::const_iterator it2=s2.begin();
-
-        //stop when either string's end has been reached
-        while ( (it1!=s1.end()) && (it2!=s2.end()) && len-- > 0)
-        {
-            if(::toupper(*it1) != ::toupper(*it2)) //letters differ?
-                // return -1 to indicate smaller than, 1 otherwise
-                return (::toupper(*it1)  < ::toupper(*it2)) ? -1 : 1;
-            //proceed to the next character in each string
-            ++it1;
-            ++it2;
-        }
-        return 0;
-    }
-
-    /**
-        @brief Returns true if the string contains a comment, introduced by #, %, ; or //.
-        @param str The string
-        @return True if the string contains a comment
-    */
-    bool hasComment(const std::string& str)
-    {
-        return (getCommentPosition(str) != std::string::npos);
-    }
-
-    /**
-        @brief If the string contains a comment, the comment gets returned (including the comment symbol), an empty string otherwise.
-        @param str The string
-        @return The comment
-    */
-    std::string getComment(const std::string& str)
-    {
-        return str.substr(getCommentPosition(str));
-    }
-
-    /**
-        @brief If the string contains a comment, the position of the comment-symbol gets returned, std::string::npos otherwise.
-        @param str The string
-        @return The position
-    */
-    size_t getCommentPosition(const std::string& str)
-    {
-        return getNextCommentPosition(str, 0);
-    }
-
-    /**
-        @brief Returns the position of the next comment-symbol, starting with start.
-        @param str The string
-        @param start The startposition
-        @return The position
-    */
-    size_t getNextCommentPosition(const std::string& str, size_t start)
-    {
-        for (size_t i = start; i < str.size(); i++)
-            if (isComment(str.substr(i)))
-                return i;
-
-        return std::string::npos;
-    }
-}
Index: code/trunk/src/util/String.h
===================================================================
--- code/trunk/src/util/String.h	(revision 3279)
+++ 	(revision )
@@ -1,81 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-/**
-    @file
-    @brief Declaration of several string manipulation functions, used in many parts of the game.
-*/
-
-#ifndef _Util_String_H__
-#define _Util_String_H__
-
-#include "UtilPrereqs.h"
-#include <string>
-
-namespace orxonox
-{
-    extern _UtilExport std::string BLANKSTRING;
-    _UtilExport std::string getUniqueNumberString();
-
-    _UtilExport void        strip(std::string* str);
-    _UtilExport std::string getStripped(const std::string& str);
-
-    _UtilExport std::string removeTrailingWhitespaces(const std::string& str);
-
-    _UtilExport size_t      getNextQuote(const std::string& str, size_t start);
-    _UtilExport bool        isBetweenQuotes(const std::string& str, size_t pos);
-
-    _UtilExport bool        hasStringBetweenQuotes(const std::string& str);
-    _UtilExport std::string getStringBetweenQuotes(const std::string& str);
-
-    _UtilExport std::string stripEnclosingQuotes(const std::string& str);
-    _UtilExport std::string stripEnclosingBraces(const std::string& str);
-
-    _UtilExport bool        isEmpty(const std::string& str);
-    _UtilExport bool        isComment(const std::string& str);
-    _UtilExport bool        isNumeric(const std::string& str);
-
-    _UtilExport std::string addSlashes(const std::string& str);
-    _UtilExport std::string removeSlashes(const std::string& str);
-
-    _UtilExport void        lowercase(std::string* str);
-    _UtilExport std::string getLowercase(const std::string& str);
-
-    _UtilExport void        uppercase(std::string* str);
-    _UtilExport std::string getUppercase(const std::string& str);
-
-    _UtilExport int         nocaseCmp(const std::string& s1, const std::string& s2);
-    _UtilExport int         nocaseCmp(const std::string& s1, const std::string& s2, size_t len);
-
-    _UtilExport bool        hasComment(const std::string& str);
-    _UtilExport std::string getComment(const std::string& str);
-    _UtilExport size_t      getCommentPosition(const std::string& str);
-    _UtilExport size_t      getNextCommentPosition(const std::string& str, size_t start = 0);
-}
-
-#endif /* _Util_String_H__ */
Index: code/trunk/src/util/StringUtils.cc
===================================================================
--- code/trunk/src/util/StringUtils.cc	(revision 3280)
+++ code/trunk/src/util/StringUtils.cc	(revision 3280)
@@ -0,0 +1,492 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      Benjamin Grauer
+ *
+ */
+
+/**
+    @file
+    @brief Implementation of several string manipulation functions.
+*/
+
+#include "StringUtils.h"
+
+#include <cctype>
+#include "Convert.h"
+#include "Math.h"
+
+namespace orxonox
+{
+    std::string BLANKSTRING("");
+
+    std::string getUniqueNumberString()
+    {
+        return multi_cast<std::string>(getUniqueNumber());
+    }
+
+    /**
+        @brief Removes all whitespaces from a string.
+        @param str The string to strip
+    */
+    void strip(std::string* str)
+    {
+        size_t pos;
+        while ((pos = (*str).find(" ")) < (*str).length())
+            (*str).erase(pos, 1);
+        while ((pos = (*str).find("\t")) < (*str).length())
+            (*str).erase(pos, 1);
+        while ((pos = (*str).find("\n")) < (*str).length())
+            (*str).erase(pos, 1);
+    }
+
+    /**
+        @brief Returns a copy of a string without whitespaces.
+        @param str The string to strip
+        @return The stripped line
+    */
+    std::string getStripped(const std::string& str)
+    {
+        std::string output = std::string(str);
+        strip(&output);
+        return output;
+    }
+
+    /**
+        @brief Returns a copy of a string without trailing whitespaces.
+        @param str The string
+        @return The modified copy
+    */
+    std::string removeTrailingWhitespaces(const std::string& str)
+    {
+        size_t pos1 = 0;
+        int pos2 = (int)(str.size() - 1);
+        for (; pos1 < str.size() && (str[pos1] == ' ' || str[pos1] == '\t' || str[pos1] == '\n'); pos1++);
+        for (; pos2 > 0         && (str[pos2] == ' ' || str[pos2] == '\t' || str[pos2] == '\n'); pos2--);
+        return str.substr(pos1, pos2 - pos1 + 1);
+    }
+
+    /**
+        @brief Returns the position of the next quote in the string, starting with start.
+        @param str The string
+        @param start The startposition
+        @return The position of the next quote (std::string::npos if there is no next quote)
+    */
+    size_t getNextQuote(const std::string& str, size_t start)
+    {
+        size_t quote = start - 1;
+
+        while ((quote = str.find('\"', quote + 1)) != std::string::npos)
+        {
+            size_t backslash = quote;
+            size_t numbackslashes = 0;
+            for (; backslash > 0; backslash--, numbackslashes++)
+                if (str[backslash - 1] != '\\')
+                    break;
+
+            if (numbackslashes % 2 == 0)
+                break;
+        }
+
+        return quote;
+    }
+
+    /**
+        @brief Returns true if pos is between two quotes.
+        @param str The string
+        @param pos The position to check
+        @return True if pos is between two quotes
+    */
+    bool isBetweenQuotes(const std::string& str, size_t pos)
+    {
+        if (pos == std::string::npos)
+            return false;
+
+        size_t quotecount = 0;
+        size_t quote = (size_t)-1;
+        while ((quote = getNextQuote(str, quote + 1)) < pos)
+        {
+            if (quote == pos)
+                return false;
+            quotecount++;
+        }
+
+        if (quote == std::string::npos)
+            return false;
+
+        return ((quotecount % 2) == 1);
+    }
+
+    /**
+        @brief Returns true if the string contains something like '..."between quotes"...'.
+        @param The string
+        @return True if there is something between quotes
+    */
+    bool hasStringBetweenQuotes(const std::string& str)
+    {
+        size_t pos1 = getNextQuote(str, 0);
+        size_t pos2 = getNextQuote(str, pos1 + 1);
+        return (pos1 != std::string::npos && pos2 != std::string::npos && pos2 > pos1 + 1);
+    }
+
+    /**
+        @brief If the string contains something like '..."between quotes"...' then 'between quotes' gets returned (without quotes).
+        @param The string
+        @param The string between the quotes
+    */
+    std::string getStringBetweenQuotes(const std::string& str)
+    {
+        size_t pos1 = getNextQuote(str, 0);
+        size_t pos2 = getNextQuote(str, pos1 + 1);
+        if (pos1 != std::string::npos && pos2 != std::string::npos)
+            return str.substr(pos1, pos2 - pos1 + 1);
+        else
+            return "";
+    }
+
+    /**
+        @brief Removes enclosing quotes if available (including whitespaces at the outside of the quotes).
+        @brief str The string to strip
+        @return The string with removed quotes
+    */
+    std::string stripEnclosingQuotes(const std::string& str)
+    {
+        size_t start = std::string::npos;
+        size_t end = 0;
+
+        for (size_t pos = 0; (pos < str.size()) && (pos < std::string::npos); pos++)
+        {
+            if (str[pos] == '"')
+            {
+                start = pos;
+                break;
+            }
+
+            if ((str[pos] != ' ') && (str[pos] != '\t') && (str[pos] != '\n'))
+                return str;
+        }
+
+        for (size_t pos = str.size() - 1; pos < std::string::npos; pos--)
+        {
+            if (str[pos] == '"')
+            {
+                end = pos;
+                break;
+            }
+
+            if ((str[pos] != ' ') && (str[pos] != '\t') && (str[pos] != '\n'))
+                return str;
+        }
+
+        if ((start != std::string::npos) && (end != 0))
+            return str.substr(start + 1, end - start - 1);
+        else
+            return str;
+    }
+
+    /**
+        @brief Removes enclosing {braces} (braces must be exactly on the beginning and the end of the string).
+        @param str The string to strip
+        @return The striped string
+    */
+    std::string stripEnclosingBraces(const std::string& str)
+    {
+        std::string output = str;
+
+        while (output.size() >= 2 && output[0] == '{' && output[output.size() - 1] == '}')
+            output = output.substr(1, output.size() - 2);
+
+        return output;
+    }
+
+    /**
+        @brief Determines if a string is a comment (starts with a comment-symbol).
+        @param str The string to check
+        @return True = it's a comment
+
+        A comment is defined by a leading '#', '%', ';' or '//'.
+    */
+    bool isComment(const std::string& str)
+    {
+        // Strip the line, whitespaces are disturbing
+        std::string teststring = getStripped(str);
+
+        // There are four possible comment-symbols:
+        //  1) #comment in script-language style
+        //  2) %comment in matlab style
+        //  3) ;comment in unreal tournament config-file style
+        //  4) //comment in code style
+        if (teststring.size() >= 2)
+        {
+            if (teststring[0] == '#' || teststring[0] == '%' || teststring[0] == ';' || (teststring[0] == '/' && teststring[1] == '/'))
+                return true;
+        }
+        else if (teststring.size() == 1)
+        {
+            if (teststring[0] == '#' || teststring[0] == '%' || teststring[0] == ';')
+                return true;
+        }
+
+        return false;
+    }
+
+    /**
+        @brief Determines if a string is empty (contains only whitespaces).
+        @param str The string to check
+        @return True = it's empty
+    */
+    bool isEmpty(const std::string& str)
+    {
+        std::string temp = getStripped(str);
+        return ((temp == "") || (temp.size() == 0));
+    }
+
+    /**
+        @brief Determines if a string contains only numbers and maximal one '.'.
+        @param str The string to check
+        @return True = it's a number
+    */
+    bool isNumeric(const std::string& str)
+    {
+        bool foundPoint = false;
+
+        for (std::string::const_iterator it = str.begin(); it != str.end(); ++it)
+        {
+            if (((*it) < '0' || (*it) > '9'))
+            {
+                if ((*it) != '.' && !foundPoint)
+                    foundPoint = true;
+                else
+                    return false;
+            }
+        }
+
+        return true;
+    }
+
+    /**
+        @brief Adds backslashes to the given string which makes special chars visible. Existing slashes will be doubled.
+        @param str The string to manipulate
+        @return The string with added slashes
+    */
+    std::string addSlashes(const std::string& str)
+    {
+        std::string output = str;
+
+        for (size_t pos = 0; (pos = output.find('\\', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\\\"); }
+        for (size_t pos = 0; (pos = output.find('\n', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\n"); }
+        for (size_t pos = 0; (pos = output.find('\t', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\t"); }
+        for (size_t pos = 0; (pos = output.find('\v', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\v"); }
+        for (size_t pos = 0; (pos = output.find('\b', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\b"); }
+        for (size_t pos = 0; (pos = output.find('\r', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\r"); }
+        for (size_t pos = 0; (pos = output.find('\f', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\f"); }
+        for (size_t pos = 0; (pos = output.find('\a', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\a"); }
+        for (size_t pos = 0; (pos = output.find('"', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\\""); }
+        for (size_t pos = 0; (pos = output.find('\0', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\0"); }
+
+        return output;
+    }
+
+    /**
+        @brief Removes backslashes from the given string. Double backslashes are interpreted as one backslash.
+        @param str The string to manipulate
+        @return The string with removed slashes
+    */
+    std::string removeSlashes(const std::string& str)
+    {
+        if (str.size() <= 1)
+            return str;
+
+        std::string output = "";
+        for (size_t pos = 0; pos < str.size() - 1; )
+        {
+            if (str[pos] == '\\')
+            {
+                if (str[pos + 1] == '\\') { output += '\\'; pos += 2; continue; }
+                else if (str[pos + 1] == 'n') { output += '\n'; pos += 2; continue; }
+                else if (str[pos + 1] == 't') { output += '\t'; pos += 2; continue; }
+                else if (str[pos + 1] == 'v') { output += '\v'; pos += 2; continue; }
+                else if (str[pos + 1] == 'b') { output += '\b'; pos += 2; continue; }
+                else if (str[pos + 1] == 'r') { output += '\r'; pos += 2; continue; }
+                else if (str[pos + 1] == 'f') { output += '\f'; pos += 2; continue; }
+                else if (str[pos + 1] == 'a') { output += '\a'; pos += 2; continue; }
+                else if (str[pos + 1] == '"') { output += '"'; pos += 2; continue; }
+                else if (str[pos + 1] == '0') { output += '\0'; pos += 2; continue; }
+            }
+            output += str[pos];
+            pos++;
+            if (pos == str.size() - 1)
+                output += str[pos];
+        }
+
+        return output;
+    }
+
+    /**
+        @brief Replaces each char between A and Z with its lowercase equivalent.
+        @param str The string to convert
+    */
+    void lowercase(std::string* str)
+    {
+        for (size_t i = 0; i < str->size(); ++i)
+        {
+            (*str)[i] = (char)tolower((*str)[i]);
+        }
+    }
+
+    /**
+        @brief Returns a copy of the given string without uppercase chars.
+        @param str The string
+        @return The copy
+    */
+    std::string getLowercase(const std::string& str)
+    {
+        std::string output = std::string(str);
+        lowercase(&output);
+        return output;
+    }
+
+    /**
+        @brief Replaces each char between a and z with its uppercase equivalent.
+        @param str The string to convert
+    */
+    void uppercase(std::string* str)
+    {
+        for (size_t i = 0; i < str->size(); ++i)
+        {
+            (*str)[i] = (char)toupper((*str)[i]);
+        }
+    }
+
+    /**
+        @brief Returns a copy of the given string without lowercase chars.
+        @param str The string
+        @return The copy
+    */
+    std::string getUppercase(const std::string& str)
+    {
+        std::string output = std::string(str);
+        uppercase(&output);
+        return output;
+    }
+
+    /**
+        @brief Compares two strings ignoring different casing.
+        @param s1 First string
+        @param s2 Second string
+    */
+    int nocaseCmp(const std::string& s1, const std::string& s2)
+    {
+        std::string::const_iterator it1=s1.begin();
+        std::string::const_iterator it2=s2.begin();
+
+        //stop when either string's end has been reached
+        while ( (it1!=s1.end()) && (it2!=s2.end()) )
+        {
+            if(::toupper(*it1) != ::toupper(*it2)) //letters differ?
+                // return -1 to indicate smaller than, 1 otherwise
+                return (::toupper(*it1)  < ::toupper(*it2)) ? -1 : 1;
+            //proceed to the next character in each string
+            ++it1;
+            ++it2;
+        }
+        size_t size1=s1.size(), size2=s2.size();// cache lengths
+        //return -1,0 or 1 according to strings' lengths
+        if (size1==size2)
+            return 0;
+        return (size1<size2) ? -1 : 1;
+    }
+
+
+    /**
+        @brief Compares the first 'len' chars of two strings ignoring different casing.
+        @param s1 First string
+        @param s2 Second string
+        @param len Maximal number of chars to compare
+    */
+    int nocaseCmp(const std::string& s1, const std::string& s2, size_t len)
+    {
+        if (len == 0)
+            return 0;
+        std::string::const_iterator it1=s1.begin();
+        std::string::const_iterator it2=s2.begin();
+
+        //stop when either string's end has been reached
+        while ( (it1!=s1.end()) && (it2!=s2.end()) && len-- > 0)
+        {
+            if(::toupper(*it1) != ::toupper(*it2)) //letters differ?
+                // return -1 to indicate smaller than, 1 otherwise
+                return (::toupper(*it1)  < ::toupper(*it2)) ? -1 : 1;
+            //proceed to the next character in each string
+            ++it1;
+            ++it2;
+        }
+        return 0;
+    }
+
+    /**
+        @brief Returns true if the string contains a comment, introduced by #, %, ; or //.
+        @param str The string
+        @return True if the string contains a comment
+    */
+    bool hasComment(const std::string& str)
+    {
+        return (getCommentPosition(str) != std::string::npos);
+    }
+
+    /**
+        @brief If the string contains a comment, the comment gets returned (including the comment symbol), an empty string otherwise.
+        @param str The string
+        @return The comment
+    */
+    std::string getComment(const std::string& str)
+    {
+        return str.substr(getCommentPosition(str));
+    }
+
+    /**
+        @brief If the string contains a comment, the position of the comment-symbol gets returned, std::string::npos otherwise.
+        @param str The string
+        @return The position
+    */
+    size_t getCommentPosition(const std::string& str)
+    {
+        return getNextCommentPosition(str, 0);
+    }
+
+    /**
+        @brief Returns the position of the next comment-symbol, starting with start.
+        @param str The string
+        @param start The startposition
+        @return The position
+    */
+    size_t getNextCommentPosition(const std::string& str, size_t start)
+    {
+        for (size_t i = start; i < str.size(); i++)
+            if (isComment(str.substr(i)))
+                return i;
+
+        return std::string::npos;
+    }
+}
Index: code/trunk/src/util/StringUtils.h
===================================================================
--- code/trunk/src/util/StringUtils.h	(revision 3280)
+++ code/trunk/src/util/StringUtils.h	(revision 3280)
@@ -0,0 +1,81 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file
+    @brief Declaration of several string manipulation functions, used in many parts of the game.
+*/
+
+#ifndef _StringUtils_H__
+#define _StringUtils_H__
+
+#include "UtilPrereqs.h"
+#include <string>
+
+namespace orxonox
+{
+    extern _UtilExport std::string BLANKSTRING;
+    _UtilExport std::string getUniqueNumberString();
+
+    _UtilExport void        strip(std::string* str);
+    _UtilExport std::string getStripped(const std::string& str);
+
+    _UtilExport std::string removeTrailingWhitespaces(const std::string& str);
+
+    _UtilExport size_t      getNextQuote(const std::string& str, size_t start);
+    _UtilExport bool        isBetweenQuotes(const std::string& str, size_t pos);
+
+    _UtilExport bool        hasStringBetweenQuotes(const std::string& str);
+    _UtilExport std::string getStringBetweenQuotes(const std::string& str);
+
+    _UtilExport std::string stripEnclosingQuotes(const std::string& str);
+    _UtilExport std::string stripEnclosingBraces(const std::string& str);
+
+    _UtilExport bool        isEmpty(const std::string& str);
+    _UtilExport bool        isComment(const std::string& str);
+    _UtilExport bool        isNumeric(const std::string& str);
+
+    _UtilExport std::string addSlashes(const std::string& str);
+    _UtilExport std::string removeSlashes(const std::string& str);
+
+    _UtilExport void        lowercase(std::string* str);
+    _UtilExport std::string getLowercase(const std::string& str);
+
+    _UtilExport void        uppercase(std::string* str);
+    _UtilExport std::string getUppercase(const std::string& str);
+
+    _UtilExport int         nocaseCmp(const std::string& s1, const std::string& s2);
+    _UtilExport int         nocaseCmp(const std::string& s1, const std::string& s2, size_t len);
+
+    _UtilExport bool        hasComment(const std::string& str);
+    _UtilExport std::string getComment(const std::string& str);
+    _UtilExport size_t      getCommentPosition(const std::string& str);
+    _UtilExport size_t      getNextCommentPosition(const std::string& str, size_t start = 0);
+}
+
+#endif /* _StringUtils_H__ */
Index: code/trunk/src/util/UtilPrereqs.h
===================================================================
--- code/trunk/src/util/UtilPrereqs.h	(revision 3279)
+++ code/trunk/src/util/UtilPrereqs.h	(revision 3280)
@@ -60,4 +60,19 @@
 // Forward declarations
 //-----------------------------------------------------------------------
+
+namespace orxonox
+{
+    class Exception;
+    class ExprParser;
+    class IntVector2;
+    class IntVector3;
+    class MultiType;
+    class OutputBuffer;
+    class OutputBufferListener;
+    class OutputHandler;
+    class SignalHandler;
+    class SubString;
+}
+
 namespace Ogre
 {
@@ -72,5 +87,4 @@
     class ColourValue;
 }
-
 namespace orxonox
 {
@@ -84,15 +98,10 @@
     using Ogre::Quaternion;
     using Ogre::ColourValue;
+}
 
-    class Exception;
-    class ExprParser;
-    class IntVector2;
-    class IntVector3;
-    class MultiType;
-    class OutputBuffer;
-    class OutputBufferListener;
-    class OutputHandler;
-    class SignalHandler;
-    class SubString;
+namespace Loki
+{
+    class ScopeGuardImplBase;
+    typedef const ScopeGuardImplBase& ScopeGuard;
 }
 
