Index: code/branches/core2/src/orxonox/Orxonox.cc
===================================================================
--- code/branches/core2/src/orxonox/Orxonox.cc	(revision 1019)
+++ code/branches/core2/src/orxonox/Orxonox.cc	(revision 1020)
@@ -89,4 +89,5 @@
 #include "core/CommandExecutor.h"
 #include "core/InputBuffer.h"
+#include "core/ConfigFileManager.h"
 
 #include "Orxonox.h"
@@ -250,4 +251,5 @@
     ogre_->startRender();
     //TODO: run engine
+    ConfigFileManager::getSingleton()->setFile(CFT_Settings, "orxonox.ini");
     Factory::createClassHierarchy();
     createScene();
@@ -1231,4 +1233,5 @@
     setupInputSystem();
     createFrameListener();
+    ConfigFileManager::getSingleton()->setFile(CFT_Settings, "orxonox.ini");
     Factory::createClassHierarchy();
     startRenderLoop();*/
@@ -1245,4 +1248,5 @@
     initializeResourceGroups();
     setupInputSystem();
+    ConfigFileManager::getSingleton()->setFile(CFT_Settings, "orxonox.ini");
     Factory::createClassHierarchy();
     createScene();
Index: code/branches/core2/src/orxonox/core/ConfigFileManager.cc
===================================================================
--- code/branches/core2/src/orxonox/core/ConfigFileManager.cc	(revision 1019)
+++ code/branches/core2/src/orxonox/core/ConfigFileManager.cc	(revision 1020)
@@ -44,25 +44,25 @@
     void reloadConfig()
     {
-        ConfigFileManager::getInstance()->load();
+        ConfigFileManager::getSingleton()->load();
     }
 
     void saveConfig()
     {
-        ConfigFileManager::getInstance()->save();
+        ConfigFileManager::getSingleton()->save();
     }
 
     void cleanConfig()
     {
-        ConfigFileManager::getInstance()->clean();
+        ConfigFileManager::getSingleton()->clean();
     }
 
     void loadSettings(const std::string& filename)
     {
-        ConfigFileManager::getInstance()->setFile(CFT_Settings, filename);
+        ConfigFileManager::getSingleton()->setFile(CFT_Settings, filename);
     }
 
     void loadKeybindings(const std::string& filename)
     {
-        ConfigFileManager::getInstance()->setFile(CFT_Keybindings, filename);
+        ConfigFileManager::getSingleton()->setFile(CFT_Keybindings, filename);
     }
 
@@ -109,6 +109,19 @@
     }
 
-    std::list<ConfigFileEntry*>::iterator ConfigFileSection::getEntryIterator(const std::string& name, unsigned int index)
-    {
+    std::list<ConfigFileEntry*>::iterator ConfigFileSection::getEntryIterator(const std::string& name, const std::string& fallback)
+    {
+std::cout << "a33333333333333333333333333\n";
+        for (std::list<ConfigFileEntry*>::iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
+            if ((*it)->getName() == name)
+                return it;
+
+        this->bUpdated_ = true;
+
+        return this->entries_.insert(this->entries_.end(), (ConfigFileEntry*)(new ConfigFileEntryValue(name, fallback)));
+    }
+
+    std::list<ConfigFileEntry*>::iterator ConfigFileSection::getEntryIterator(const std::string& name, unsigned int index, const std::string& fallback)
+    {
+std::cout << "b3333333333333333333333333\n";
         for (std::list<ConfigFileEntry*>::iterator it = this->entries_.begin(); it != this->entries_.end(); ++it)
             if (((*it)->getName() == name) && ((*it)->getIndex() == index))
@@ -118,7 +131,7 @@
 
         if (index == 0)
-            return this->entries_.insert(this->entries_.end(), (ConfigFileEntry*)(new ConfigFileEntryArrayValue(name, index)));
+            return this->entries_.insert(this->entries_.end(), (ConfigFileEntry*)(new ConfigFileEntryArrayValue(name, index, fallback)));
         else
-            return this->entries_.insert(this->getEntryIterator(name, index - 1), (ConfigFileEntry*)(new ConfigFileEntryArrayValue(name, index)));
+            return this->entries_.insert(this->getEntryIterator(name, index - 1), (ConfigFileEntry*)(new ConfigFileEntryArrayValue(name, index, fallback)));
     }
 
@@ -184,16 +197,18 @@
                 if (isComment(line))
                 {
+std::cout << "1_7\n";
                     // New comment
-                    newsection->getEntries().insert(newsection->getEntries().end(), new ConfigFileEntryComment(line));
+                    newsection->getEntries().insert(newsection->getEntries().end(), new ConfigFileEntryComment(removeTrailingWhitespaces(line)));
                     continue;
                 }
                 else
                 {
+std::cout << "1_8\n";
                     unsigned int pos1 = line.find('=');
 
                     if (pos1 != std::string::npos && pos1 > 0)
                     {
+std::cout << "1_9\n";
                         // New entry
-
                         unsigned int pos2 = line.find('[');
                         unsigned int pos3 = line.find(']');
@@ -205,17 +220,29 @@
                         if (value.size() > 0 && value[0] == '"' && betweenQuotes != "" && betweenQuotes.size() > 0)
                         {
+std::cout << "1_10\n";
                             value = betweenQuotes;
-                            comment = getComment(value.substr(betweenQuotes.size() + 2));
+                            if (line.size() > pos1 + 1 + betweenQuotes.size() + 2)
+                                comment = removeTrailingWhitespaces(getComment(line.substr(pos1 + 1 + betweenQuotes.size() + 2)));
                         }
                         else
                         {
+std::cout << "1_11\n";
                             unsigned int pos4 = getCommentPosition(line);
+std::cout << "a\n";
+std::cout << line << std::endl;
+std::cout << line.substr(pos1 + 1, pos4 - pos1 - 1) << std::endl;
                             value = removeTrailingWhitespaces(line.substr(pos1 + 1, pos4 - pos1 - 1));
-                            comment = line.substr(pos4);
+std::cout << value << std::endl;
+std::cout << "b\n";
+                            if (pos4 != std::string::npos)
+                                comment = removeTrailingWhitespaces(line.substr(pos4));
+std::cout << comment << std::endl;
+std::cout << "c\n";
                         }
 
-
+std::cout << "1_12\n";
                         if (pos2 != std::string::npos && pos3 != std::string::npos && pos3 > pos2 + 1)
                         {
+std::cout << "1_13\n";
                             // There might be an array index
                             unsigned int index = 0;
@@ -224,4 +251,5 @@
                                 // New array
                                 newsection->getEntries().insert(newsection->getEntries().end(), new ConfigFileEntryArrayValue(getStripped(line.substr(0, pos2)), index, value, comment));
+std::cout << "1_14\n";
                                 continue;
                             }
@@ -230,4 +258,5 @@
                         // New value
                         newsection->getEntries().insert(newsection->getEntries().end(), new ConfigFileEntryValue(getStripped(line.substr(0, pos1)), value, comment));
+std::cout << "1_15\n";
                         continue;
                     }
@@ -235,9 +264,13 @@
             }
         }
+std::cout << "1_16\n";
 
         file.close();
+
+        COUT(3) << "Loaded config file \"" << this->filename_ << "\"." << std::endl;
 
         // Save the file in case something changed (like stripped whitespaces)
         this->save();
+std::cout << "1_17\n";
     }
 
@@ -269,4 +302,6 @@
 
         file.close();
+
+        COUT(4) << "Saved config file \"" << this->filename_ << "\"." << std::endl;
     }
 
@@ -277,4 +312,5 @@
     ConfigFileSection* ConfigFile::getSection(const std::string& section)
     {
+std::cout << "22222222222222222222\n";
         for (std::list<ConfigFileSection*>::iterator it = this->sections_.begin(); it != this->sections_.end(); ++it)
             if ((*it)->getName() == section)
@@ -321,5 +357,5 @@
     }
 
-    ConfigFileManager* ConfigFileManager::getInstance()
+    ConfigFileManager* ConfigFileManager::getSingleton()
     {
         static ConfigFileManager instance;
@@ -397,4 +433,5 @@
     ConfigFile* ConfigFileManager::getFile(ConfigFileType type)
     {
+std::cout << "111111111111111111\n";
         std::map<ConfigFileType, ConfigFile*>::iterator it = this->configFiles_.find(type);
         if (it != this->configFiles_.end())
Index: code/branches/core2/src/orxonox/core/ConfigFileManager.h
===================================================================
--- code/branches/core2/src/orxonox/core/ConfigFileManager.h	(revision 1019)
+++ code/branches/core2/src/orxonox/core/ConfigFileManager.h	(revision 1020)
@@ -76,5 +76,5 @@
     {
         public:
-            inline ConfigFileEntryValue(const std::string& name, const std::string& value = "", const std::string& additionalComment = "") : name_(name), value_(value), additionalComment_(additionalComment), bString_(false) {}
+            inline ConfigFileEntryValue(const std::string& name, const std::string& value = "", const std::string& additionalComment = "") : name_(name), value_(value), additionalComment_(additionalComment), bString_(false) { std::cout << "************* " << value << std::endl; }
             inline virtual ~ConfigFileEntryValue() {}
 
@@ -161,12 +161,12 @@
 
             inline void setValue(const std::string& name, const std::string& value)
-                { this->getEntry(name)->setValue(value); }
-            inline const std::string& getValue(const std::string& name)
-                { return this->getEntry(name)->getValue(); }
+                { this->getEntry(name, value)->setValue(value); }
+            inline const std::string& getValue(const std::string& name, const std::string& fallback)
+                { return this->getEntry(name, fallback)->getValue(); }
 
             inline void setValue(const std::string& name, unsigned int index, const std::string& value)
-                { this->getEntry(name, index)->setValue(value); }
-            inline const std::string& getValue(const std::string& name, unsigned int index)
-                { return this->getEntry(name, index)->getValue(); }
+                { this->getEntry(name, index, value)->setValue(value); }
+            inline const std::string& getValue(const std::string& name, unsigned int index, const std::string& fallback)
+                { return this->getEntry(name, index, fallback)->getValue(); }
 
             std::string getFileEntry() const;
@@ -180,10 +180,11 @@
                 { return this->entries_.end(); }
 
-            std::list<ConfigFileEntry*>::iterator getEntryIterator(const std::string& name, unsigned int index);
-
-            inline ConfigFileEntry* getEntry(const std::string& name)
-                { return (*this->getEntryIterator(name, 0)); }
-            inline ConfigFileEntry* getEntry(const std::string& name, unsigned int index)
-                { return (*this->getEntryIterator(name, index)); }
+            std::list<ConfigFileEntry*>::iterator getEntryIterator(const std::string& name, const std::string& fallback = "");
+            std::list<ConfigFileEntry*>::iterator getEntryIterator(const std::string& name, unsigned int index, const std::string& fallback = "");
+
+            inline ConfigFileEntry* getEntry(const std::string& name, const std::string& fallback)
+                { return (*this->getEntryIterator(name, fallback)); }
+            inline ConfigFileEntry* getEntry(const std::string& name, unsigned int index, const std::string& fallback)
+                { return (*this->getEntryIterator(name, index, fallback)); }
 
             std::string name_;
@@ -209,11 +210,11 @@
             inline void setValue(const std::string& section, const std::string& name, const std::string& value)
                 { this->getSection(section)->setValue(name, value); this->save(); }
-            inline const std::string& getValue(const std::string& section, const std::string& name)
-                { return this->getSection(section)->getValue(name); this->saveIfUpdated(); }
+            inline const std::string& getValue(const std::string& section, const std::string& name, const std::string& fallback)
+                { return this->getSection(section)->getValue(name, fallback); this->saveIfUpdated(); }
 
             inline void setValue(const std::string& section, const std::string& name, unsigned int index, const std::string& value)
                 { this->getSection(section)->setValue(name, index, value); this->save(); }
-            inline const std::string& getValue(const std::string& section, const std::string& name, unsigned int index)
-                { return this->getSection(section)->getValue(name, index); this->saveIfUpdated(); }
+            inline const std::string& getValue(const std::string& section, const std::string& name, unsigned int index, const std::string& fallback)
+                { return this->getSection(section)->getValue(name, index, fallback); this->saveIfUpdated(); }
 
         private:
@@ -233,5 +234,5 @@
     {
         public:
-            static ConfigFileManager* getInstance();
+            static ConfigFileManager* getSingleton();
 
             void setFile(ConfigFileType type, const std::string& filename);
@@ -247,11 +248,11 @@
             inline void setValue(ConfigFileType type, const std::string& section, const std::string& name, const std::string& value)
                 { this->getFile(type)->setValue(section, name, value); }
-            inline const std::string& getValue(ConfigFileType type, const std::string& section, const std::string& name)
-                { return this->getFile(type)->getValue(section, name); }
+            inline const std::string& getValue(ConfigFileType type, const std::string& section, const std::string& name, const std::string& fallback)
+                { return this->getFile(type)->getValue(section, name, fallback); }
 
             inline void setValue(ConfigFileType type, const std::string& section, const std::string& name, unsigned int index, const std::string& value)
                 { this->getFile(type)->setValue(section, name, index, value); }
-            inline const std::string& getValue(ConfigFileType type, const std::string& section, const std::string& name, unsigned int index)
-                { return this->getFile(type)->getValue(section, name, index); }
+            inline const std::string& getValue(ConfigFileType type, const std::string& section, const std::string& name, unsigned int index, const std::string& fallback)
+                { return this->getFile(type)->getValue(section, name, index, fallback); }
 
             void updateConfigValues() const;
Index: code/branches/core2/src/orxonox/core/ConfigValueContainer.cc
===================================================================
--- code/branches/core2/src/orxonox/core/ConfigValueContainer.cc	(revision 1019)
+++ code/branches/core2/src/orxonox/core/ConfigValueContainer.cc	(revision 1020)
@@ -35,8 +35,5 @@
 #include "ConfigValueContainer.h"
 #include "Language.h"
-#include "Iterator.h"
-#include "BaseObject.h"
 
-#define CONFIGFILEPATH "orxonox.ini"
 
 namespace orxonox
@@ -49,16 +46,15 @@
         @param defvalue The default-value
     */
-    ConfigValueContainer::ConfigValueContainer(Identifier* identifier, const std::string& varname, MultiTypeMath defvalue)
+    ConfigValueContainer::ConfigValueContainer(ConfigFileType type, Identifier* identifier, const std::string& varname, MultiTypeMath defvalue)
     {
-        this->bAddedDescription_ = false;
+        this->type_ = type;
         this->identifier_ = identifier;
+        this->sectionname_ = identifier->getName();
         this->varname_ = varname;
 
-        this->defvalueString_ = defvalue.toString();                                // Convert the default-value to a string
-        this->searchLineInConfigFile();                                             // Search the entry in the config-file
+        this->bAddedDescription_ = false;
 
-        std::string valueString = this->parseValueStringFromConfigFile(!(defvalue.isA(MT_string) || defvalue.isA(MT_constchar)));     // Parses the value string from the config-file-entry
-        if (!this->parse(valueString, defvalue))                                    // Try to convert the string to a value
-            this->resetLineInConfigFile();                                            // The conversion failed
+        this->defvalueString_ = defvalue.toString();
+        this->update();
     }
 
@@ -94,4 +90,15 @@
     {
         return this->set(this->defvalueString_);
+    }
+
+    /**
+        @brief Retrieves the configured value from the currently loaded config-file.
+    */
+    void ConfigValueContainer::update()
+    {
+std::cout << "AAA1: " << this->value_ << std::endl;
+std::cout << "    : " << ConfigFileManager::getSingleton()->getValue(this->type_, this->sectionname_, this->varname_, this->defvalueString_) << std::endl;
+        this->value_.fromString(ConfigFileManager::getSingleton()->getValue(this->type_, this->sectionname_, this->varname_, this->defvalueString_));
+std::cout << "AAA2: " << this->value_ << std::endl;
     }
 
@@ -138,6 +145,5 @@
     void ConfigValueContainer::setLineInConfigFile(const std::string& input)
     {
-        (*this->configFileLine_) = this->varname_ + "=" + input;
-        ConfigValueContainer::writeConfigFile(CONFIGFILEPATH);
+        ConfigFileManager::getSingleton()->setValue(this->type_, this->sectionname_, this->varname_, input);
     }
 
@@ -147,229 +153,5 @@
     void ConfigValueContainer::resetLineInConfigFile()
     {
-        this->setLineInConfigFile(this->defvalueString_);
-    }
-
-    /**
-        @brief Searches the corresponding entry in the config-file and creates it, if there is no entry.
-    */
-    void ConfigValueContainer::searchLineInConfigFile()
-    {
-        // Read the file if needed
-        if (!ConfigValueContainer::finishedReadingConfigFile())
-            ConfigValueContainer::readConfigFile(CONFIGFILEPATH);
-
-        // The string of the section we're searching
-        std::string section = "";
-        section.append("[");
-        section.append(this->identifier_->getName());
-        section.append("]");
-
-        // Iterate through all config-file-lines
-        bool success = false;
-        std::list<std::string>::iterator it1;
-        for(it1 = ConfigValueContainer::getConfigFileLines().begin(); it1 != ConfigValueContainer::getConfigFileLines().end(); ++it1)
-        {
-            // Don't try to parse comments
-            if (isComment(*it1))
-                continue;
-
-            if ((*it1).find(section) < (*it1).length())
-            {
-                // We found the right section
-                bool bLineIsEmpty = false;
-                std::list<std::string>::iterator positionToPutNewLineAt;
-
-                // Iterate through all lines in the section
-                std::list<std::string>::iterator it2;
-                for(it2 = ++it1; it2 != ConfigValueContainer::getConfigFileLines().end(); ++it2)
-                {
-                    // Don't try to parse comments
-                    if (isComment(*it2))
-                        continue;
-
-                    // This if-else block is used to write a new line right after the last line of the
-                    // section but in front of the following empty lines before the next section.
-                    // (So this helps to keep a nice formatting with empty-lines between sections in the config-file)
-                    if (isEmpty(*it2))
-                    {
-                        if (!bLineIsEmpty)
-                        {
-                            bLineIsEmpty = true;
-                            positionToPutNewLineAt = it2;
-                        }
-                    }
-                    else
-                    {
-                        if (!bLineIsEmpty)
-                            positionToPutNewLineAt = it2;
-
-                        bLineIsEmpty = false;
-                    }
-
-                    // Look out for the beginning of the next section
-                    unsigned int open = (*it2).find("[");
-                    unsigned int close = (*it2).find("]");
-                    if ((open < (*it2).length()) && (close < (*it2).length()) && (open < close))
-                    {
-                        // The next section startet, so our line isn't yet in the file - now we add it and safe the file
-                        this->configFileLine_ = this->getConfigFileLines().insert(positionToPutNewLineAt, this->varname_ + "=" + this->defvalueString_);
-                        ConfigValueContainer::writeConfigFile(CONFIGFILEPATH);
-                        success = true;
-                        break;
-                    }
-
-                    // Look out for the variable-name
-                    if ((*it2).find(this->varname_) < (*it2).length())
-                    {
-                        // We found the right line - safe it and return
-                        this->configFileLine_ = it2;
-                        success = true;
-                        break;
-                    }
-                }
-
-                // Check if we succeeded
-                if (!success)
-                {
-                    // Looks like we found the right section, but the file ended without containing our variable - so we add it and safe the file
-                    this->configFileLine_ = this->getConfigFileLines().insert(positionToPutNewLineAt, this->varname_ + "=" + this->defvalueString_);
-                    ConfigValueContainer::writeConfigFile(CONFIGFILEPATH);
-                    success = true;
-                }
-                break;
-            }
-        }
-
-        // Check if we succeeded
-        if (!success)
-        {
-            // We obviously didn't found the right section, so we'll create it
-            this->getConfigFileLines().push_back("[" + this->identifier_->getName() + "]");                   // Create the section
-            this->getConfigFileLines().push_back(this->varname_ + "=" + this->defvalueString_);   // Create the line
-            this->configFileLine_ = --this->getConfigFileLines().end();                           // Set the pointer to the last element
-            success = true;
-            this->getConfigFileLines().push_back("");                                             // Add an empty line - this is needed for the algorithm in the searchLineInConfigFile-function
-            ConfigValueContainer::writeConfigFile(CONFIGFILEPATH);                                // Save the changed config-file
-        }
-    }
-
-    /**
-        @brief Returns the part in the corresponding config-file-entry of the container that defines the value.
-        @param bStripped True = strip the value-string
-        @return The value-string
-    */
-    std::string ConfigValueContainer::parseValueStringFromConfigFile(bool bStripped)
-    {
-        std::string output;
-        if (bStripped)
-            output = getStripped(*this->configFileLine_);
-        else
-            output = *this->configFileLine_;
-
-        return output.substr(output.find("=") + 1);
-    }
-
-    /**
-        @brief Rreturns a list, containing all entrys in the config-file.
-        @return The list
-    */
-    std::list<std::string>& ConfigValueContainer::getConfigFileLines()
-    {
-        // This is done to avoid problems while executing this code before main()
-        static std::list<std::string> configFileLinesStaticReference = std::list<std::string>();
-        return configFileLinesStaticReference;
-    }
-
-    /**
-        @brief Returns true if the ConfigFile is read and stored into the ConfigFile-lines-list.
-        @param finished This is used to change the state
-        @return True if the ConfigFile is read and stored into the ConfigFile-lines-list
-    */
-    bool ConfigValueContainer::finishedReadingConfigFile(bool finished)
-    {
-        // This is done to avoid problems while executing this code before main()
-        static bool finishedReadingConfigFileStaticVariable = false;
-
-        if (finished)
-            finishedReadingConfigFileStaticVariable = true;
-
-        return finishedReadingConfigFileStaticVariable;
-    }
-
-    /**
-        @brief Reads the config-file and stores the lines in a list.
-        @param filename The name of the config-file
-    */
-    void ConfigValueContainer::readConfigFile(const std::string& filename)
-    {
-        // This creates the file if it's not existing
-        std::ofstream createFile;
-        createFile.open(filename.c_str(), std::fstream::app);
-        createFile.close();
-
-        // Open the file
-        std::ifstream file;
-        file.open(filename.c_str(), std::fstream::in);
-
-        if (!file.is_open())
-        {
-            COUT(1) << "An error occurred in ConfigValueContainer.cc:" << std::endl;
-            COUT(1) << "Error: Couldn't open config-file " << filename << " to read the config values!" << std::endl;
-            return;
-        }
-
-        char line[1024];
-
-        // Iterate through the file and add the lines into the list
-        while (file.good() && !file.eof())
-        {
-            file.getline(line, 1024);
-            ConfigValueContainer::getConfigFileLines().push_back(line);
-        }
-
-        // The last line is useless
-        ConfigValueContainer::getConfigFileLines().pop_back();
-
-        // Add an empty line to the end of the file if needed
-        // this is needed for the algorithm in the searchLineInConfigFile-function
-        if ((ConfigValueContainer::getConfigFileLines().size() > 0) && !isEmpty(*ConfigValueContainer::getConfigFileLines().rbegin()))
-            ConfigValueContainer::getConfigFileLines().push_back("");
-
-        file.close();
-
-        ConfigValueContainer::finishedReadingConfigFile(true);
-    }
-
-    /**
-        @brief Writes the content of the list, containing all lines of the config-file, into the config-file.
-        @param filename The name of the config-file
-    */
-    void ConfigValueContainer::writeConfigFile(const std::string& filename)
-    {
-        // Make sure we stored the config-file in the list
-        if (!ConfigValueContainer::finishedReadingConfigFile())
-            ConfigValueContainer::readConfigFile(filename);
-
-        // Open the file
-        std::ofstream file;
-        file.open(filename.c_str(), std::fstream::out);
-        file.setf(std::ios::fixed, std::ios::floatfield);
-        file.precision(6);
-
-        if (!file.is_open())
-        {
-            COUT(1) << "An error occurred in ConfigValueContainer.cc:" << std::endl;
-            COUT(1) << "Error: Couldn't open config-file " << filename << " to write the config values!" << std::endl;
-            return;
-        }
-
-        // Iterate through the list an write the lines into the file
-        std::list<std::string>::iterator it;
-        for (it = ConfigValueContainer::getConfigFileLines().begin(); it != ConfigValueContainer::getConfigFileLines().end(); ++it)
-        {
-            file << (*it) << std::endl;
-        }
-
-        file.close();
+        this->setLineInConfigFile(this->value_.toString());
     }
 
Index: code/branches/core2/src/orxonox/core/ConfigValueContainer.h
===================================================================
--- code/branches/core2/src/orxonox/core/ConfigValueContainer.h	(revision 1019)
+++ code/branches/core2/src/orxonox/core/ConfigValueContainer.h	(revision 1020)
@@ -50,4 +50,5 @@
 #include "util/Math.h"
 #include "util/MultiTypeMath.h"
+#include "ConfigFileManager.h"
 
 namespace orxonox
@@ -72,5 +73,5 @@
     {
         public:
-            ConfigValueContainer(Identifier* identifier, const std::string& varname, MultiTypeMath defvalue);
+            ConfigValueContainer(ConfigFileType type, Identifier* identifier, const std::string& varname, MultiTypeMath defvalue);
 
             /** @brief Returns the configured value. @param value This is only needed to determine the right type. @return The value */
@@ -88,4 +89,5 @@
             bool tset(const std::string& input);
             bool reset();
+            void update();
 
             /** @brief Converts the config-value to a string. @return The string */
@@ -97,9 +99,4 @@
 
         private:
-            static void readConfigFile(const std::string& filename);
-            static void writeConfigFile(const std::string& filename);
-            static std::list<std::string>& getConfigFileLines();
-            static bool finishedReadingConfigFile(bool finished = false);
-
             bool parse(const std::string& input);
             bool parse(const std::string& input, const MultiTypeMath& defvalue);
@@ -107,9 +104,8 @@
             void setLineInConfigFile(const std::string& input);
             void resetLineInConfigFile();
-            void searchLineInConfigFile();
 
-            std::string parseValueStringFromConfigFile(bool bStripped = true);
-
-            Identifier*         identifier_;                    //!< The name of the class the variable belongs to
+            ConfigFileType      type_;                          //!< The type of the corresponding config-file
+            Identifier*         identifier_;                    //!< The identifier of the class
+            std::string         sectionname_;                   //!< The name of the class the variable belongs to
             std::string         varname_;                       //!< The name of the variable
             std::string         defvalueString_;                //!< The string of the default-variable
Index: code/branches/core2/src/orxonox/core/CoreIncludes.h
===================================================================
--- code/branches/core2/src/orxonox/core/CoreIncludes.h	(revision 1019)
+++ code/branches/core2/src/orxonox/core/CoreIncludes.h	(revision 1020)
@@ -50,4 +50,5 @@
 #include "OrxonoxClass.h"
 #include "ConfigValueContainer.h"
+#include "ConfigFileManager.h"
 #include "Debug.h"
 
@@ -120,5 +121,5 @@
     if (!container##varname) \
     { \
-        container##varname = new orxonox::ConfigValueContainer(this->getIdentifier(), #varname, varname = defvalue); \
+        container##varname = new orxonox::ConfigValueContainer(CFT_Settings, this->getIdentifier(), #varname, varname = defvalue); \
         this->getIdentifier()->addConfigValueContainer(#varname, container##varname); \
     } \
@@ -139,3 +140,16 @@
         COUT(2) << "Warning: Couldn't reset variable " << #varname << ", corresponding container doesn't exist." << std::endl
 
+/**
+    @brief Assigns the command, defined in the keybind-file, to the key-variable (or an empty string, if there is no entry in the file).
+    @param varname The name of the key-variable
+*/
+#define SetKeybind(keyname) \
+    orxonox::ConfigValueContainer* container##keyname = this->getIdentifier()->getConfigValueContainer(#keyname); \
+    if (!container##keyname) \
+    { \
+        container##keyname = new orxonox::ConfigValueContainer(CFT_Keybindings, this->getIdentifier(), #keyname, keyname = ""); \
+        this->getIdentifier()->addConfigValueContainer(#keyname, container##keyname); \
+    } \
+    container##keyname->getValue(&varname)
+
 #endif /* _CoreIncludes_H__ */
Index: code/branches/core2/src/orxonox/core/DebugLevel.cc
===================================================================
--- code/branches/core2/src/orxonox/core/DebugLevel.cc	(revision 1019)
+++ code/branches/core2/src/orxonox/core/DebugLevel.cc	(revision 1020)
@@ -95,5 +95,5 @@
 
         // Return a constant value while we're creating the object
-        return 2;
+        return 4;
     }
 }
Index: code/branches/core2/src/orxonox/core/Language.cc
===================================================================
--- code/branches/core2/src/orxonox/core/Language.cc	(revision 1019)
+++ code/branches/core2/src/orxonox/core/Language.cc	(revision 1020)
@@ -108,4 +108,5 @@
 
         // Read the translation file after the language was configured
+std::cout << "asdfasdfkjsfkdjaslfkjsaflkjsdfkl\n";
         this->readTranslatedLanguageFile();
     }
Index: code/branches/core2/src/util/MultiTypeMath.cc
===================================================================
--- code/branches/core2/src/util/MultiTypeMath.cc	(revision 1019)
+++ code/branches/core2/src/util/MultiTypeMath.cc	(revision 1020)
@@ -169,6 +169,5 @@
         ConvertValue(&output, this->vector3_);
     else if (this->type_ == MT_colourvalue)
-    { std::cout << "3_1\n";
-        ConvertValue(&output, this->colourvalue_);}
+        ConvertValue(&output, this->colourvalue_);
     else if (this->type_ == MT_quaternion)
         ConvertValue(&output, this->quaternion_);
@@ -190,6 +189,5 @@
         return ConvertValue(&this->vector3_, value, orxonox::Vector3(0, 0, 0));
     else if (this->type_ == MT_colourvalue)
-    { std::cout << "4_1\n";
-        return ConvertValue(&this->colourvalue_, value, orxonox::ColourValue(0, 0, 0, 0)); }
+        return ConvertValue(&this->colourvalue_, value, orxonox::ColourValue(0, 0, 0, 0));
     else if (this->type_ == MT_quaternion)
         return ConvertValue(&this->quaternion_, value, orxonox::Quaternion(1, 0, 0, 0));
Index: code/branches/core2/src/util/String.cc
===================================================================
--- code/branches/core2/src/util/String.cc	(revision 1019)
+++ code/branches/core2/src/util/String.cc	(revision 1020)
@@ -62,4 +62,34 @@
 std::string removeTrailingWhitespaces(const std::string& str)
 {
+    unsigned int pos1 = 0;
+    unsigned int pos2 = 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)
+*/
+unsigned int getNextQuote(const std::string& str, unsigned int start)
+{
+    unsigned int quote = start - 1;
+
+    while ((quote = str.find('\"', quote + 1)) != std::string::npos)
+    {
+        unsigned int backslash = quote;
+        unsigned int numbackslashes = 0;
+        for (; backslash > 0; backslash--, numbackslashes++)
+            if (str[backslash - 1] != '\\')
+                break;
+
+        if (numbackslashes % 2 == 0)
+            break;
+    }
+
+    return quote;
 }
 
@@ -71,4 +101,7 @@
 bool hasStringBetweenQuotes(const std::string& str)
 {
+    unsigned int pos1 = getNextQuote(str, 0);
+    unsigned int pos2 = getNextQuote(str, pos1 + 1);
+    return (pos1 != std::string::npos && pos2 != std::string::npos && pos2 > pos1 + 1);
 }
 
@@ -80,4 +113,10 @@
 std::string getStringBetweenQuotes(const std::string& str)
 {
+    unsigned int pos1 = getNextQuote(str, 0);
+    unsigned int pos2 = getNextQuote(str, pos1 + 1);
+    if (pos1 != std::string::npos && pos2 != std::string::npos)
+        return str.substr(pos1, pos2 - pos1 + 1);
+    else
+        return "";
 }
 
Index: code/branches/core2/src/util/String.h
===================================================================
--- code/branches/core2/src/util/String.h	(revision 1019)
+++ code/branches/core2/src/util/String.h	(revision 1020)
@@ -38,4 +38,6 @@
 
 _UtilExport std::string  removeTrailingWhitespaces(const std::string& str);
+
+_UtilExport unsigned int getNextQuote(const std::string& str, unsigned int start);
 
 _UtilExport bool         hasStringBetweenQuotes(const std::string& str);
