Index: /code/branches/core4/src/core/input/Button.cc
===================================================================
--- /code/branches/core4/src/core/input/Button.cc	(revision 3278)
+++ /code/branches/core4/src/core/input/Button.cc	(revision 3279)
@@ -60,5 +60,4 @@
         nCommands_[2]=0;
         this->configContainer_ = 0;
-        clear();
     }
 
@@ -83,8 +82,4 @@
                 commands_[j] = 0;
                 nCommands_[j] = 0;
-            }
-            else
-            {
-                commands_[j] = 0;
             }
         }
Index: /code/branches/core4/src/core/input/HalfAxis.cc
===================================================================
--- /code/branches/core4/src/core/input/HalfAxis.cc	(revision 3278)
+++ /code/branches/core4/src/core/input/HalfAxis.cc	(revision 3279)
@@ -49,8 +49,4 @@
             nParamCommands_ = 0;
         }
-        else
-        {
-            nParamCommands_ = 0; nParamCommands_ = 0;
-        }
     }
 
Index: /code/branches/core4/src/core/input/InputDevice.h
===================================================================
--- /code/branches/core4/src/core/input/InputDevice.h	(revision 3278)
+++ /code/branches/core4/src/core/input/InputDevice.h	(revision 3279)
@@ -113,5 +113,5 @@
             : InputDevice(id)
         {
-            OIS::InputManager* system = InputManager::getInstance().getInputSystem();
+            OIS::InputManager* system = InputManager::getInstance().getOISInputManager();
             oisDevice_ = static_cast<OISDeviceClass*>(system->createInputObject(OISDeviceValue, true));
             oisDevice_->setEventCallback(static_cast<DeviceClass*>(this));
@@ -123,5 +123,5 @@
             try
             {
-                InputManager::getInstance().getInputSystem()->destroyInputObject(oisDevice_);
+                InputManager::getInstance().getOISInputManager()->destroyInputObject(oisDevice_);
             }
             catch (...)
Index: /code/branches/core4/src/core/input/InputManager.cc
===================================================================
--- /code/branches/core4/src/core/input/InputManager.cc	(revision 3278)
+++ /code/branches/core4/src/core/input/InputManager.cc	(revision 3279)
@@ -36,11 +36,10 @@
 #include "InputManager.h"
 
+#include <cassert>
 #include <climits>
-#include <cassert>
 #include <ois/OISException.h>
 #include <ois/OISInputManager.h>
 #include <boost/foreach.hpp>
 
-#include "util/Convert.h"
 #include "util/Exception.h"
 #include "util/ScopeGuard.h"
@@ -54,8 +53,6 @@
 #include "InputBuffer.h"
 #include "KeyDetector.h"
-#include "InputHandler.h"
-#include "InputState.h"
+#include "JoyStick.h"
 #include "JoyStickQuantityListener.h"
-#include "JoyStick.h"
 #include "Mouse.h"
 #include "Keyboard.h"
@@ -63,9 +60,12 @@
 namespace orxonox
 {
-    SetConsoleCommand(InputManager, calibrate, true);
-    SetConsoleCommand(InputManager, reload, false);
+    // TODO: Add console commands again as member commands
+    //SetConsoleCommand(InputManager, calibrate, true);
+    //SetConsoleCommand(InputManager, reload, false);
     SetCommandLineSwitch(keyboard_no_grab).information("Whether not to exclusively grab the keyboard");
 
+    // Abuse of this source file for the InputHandler
     InputHandler InputHandler::EMPTY;
+
     InputManager* InputManager::singletonRef_s = 0;
 
@@ -74,8 +74,7 @@
         Defines the |= operator for easier use.
     */
-    inline InputManager::InputManagerState operator|=(InputManager::InputManagerState& lval,
-                                                      InputManager::InputManagerState rval)
-    {
-        return (lval = (InputManager::InputManagerState)(lval | rval));
+    inline InputManager::State operator|=(InputManager::State& lval, InputManager::State rval)
+    {
+        return (lval = (InputManager::State)(lval | rval));
     }
 
@@ -84,7 +83,7 @@
         Defines the &= operator for easier use.
     */
-    inline InputManager::InputManagerState operator&=(InputManager::InputManagerState& lval, int rval)
-    {
-        return (lval = (InputManager::InputManagerState)(lval & rval));
+    inline InputManager::State operator&=(InputManager::State& lval, int rval)
+    {
+        return (lval = (InputManager::State)(lval & rval));
     }
 
@@ -93,5 +92,4 @@
     // ##########                                        ##########
     // ############################################################
-
     /**
     @brief
@@ -100,11 +98,11 @@
     */
     InputManager::InputManager(size_t windowHnd, unsigned int windowWidth, unsigned int windowHeight)
-        : inputSystem_(0)
+        : internalState_(Bad)
+        , oisInputManager_(0)
         , devices_(2)
         , windowHnd_(0)
-        , internalState_(Uninitialised)
-        , stateEmpty_(0)
+        , emptyState_(0)
         , keyDetector_(0)
-        , calibratorCallbackBuffer_(0)
+        , calibratorCallbackHandler_(0)
     {
         RegisterRootObject(InputManager);
@@ -113,7 +111,48 @@
         singletonRef_s = this;
 
-        setConfigValues();
-
-        initialise(windowHnd, windowWidth, windowHeight);
+        CCOUT(4) << "Constructing..." << std::endl;
+
+        this->setConfigValues();
+
+        this->loadDevices(windowHnd, windowWidth, windowHeight);
+
+        // Lowest priority empty InputState
+        emptyState_ = createInputState("empty", false, false, InputStatePriority::Empty);
+        emptyState_->setHandler(&InputHandler::EMPTY);
+        activeStates_[emptyState_->getPriority()] = emptyState_;
+
+        // KeyDetector to evaluate a pressed key's name
+        InputState* detector = createInputState("detector", false, false, InputStatePriority::Detector);
+        // Create a callback to avoid buttonHeld events after the key has been detected
+        FunctorMember<InputManager>* bufferFunctor = createFunctor(&InputManager::clearBuffers);
+        bufferFunctor->setObject(this);
+        detector->setLeaveFunctor(bufferFunctor);
+        keyDetector_ = new KeyDetector();
+        detector->setHandler(keyDetector_);
+
+        // Joy stick calibration helper callback
+        InputState* calibrator = createInputState("calibrator", false, false, InputStatePriority::Calibrator);
+        calibrator->setHandler(&InputHandler::EMPTY);
+        calibratorCallbackHandler_ = new InputBuffer();
+        calibratorCallbackHandler_->registerListener(this, &InputManager::stopCalibration, '\r', true);
+        calibrator->setKeyHandler(calibratorCallbackHandler_);
+
+        this->updateActiveStates();
+
+        {
+            // calibrate console command
+            FunctorMember<InputManager>* functor = createFunctor(&InputManager::calibrate);
+            functor->setObject(this);
+            this->getIdentifier()->addConsoleCommand(createConsoleCommand(functor, "calibrate"), true);
+        }
+        {
+            // reload console command
+            FunctorMember<InputManager>* functor = createFunctor(&InputManager::reload);
+            functor->setObject(this);
+            this->getIdentifier()->addConsoleCommand(createConsoleCommand(functor, "reload"), false);
+        }
+
+        internalState_ = Nothing;
+        CCOUT(4) << "Construction complete." << std::endl;
     }
 
@@ -137,120 +176,75 @@
         The height of the render window
     */
-    void InputManager::initialise(size_t windowHnd, unsigned int windowWidth, unsigned int windowHeight)
-    {
-        CCOUT(3) << "Initialising Input System..." << std::endl;
-
-        if (!(internalState_ & OISReady))
-        {
-            CCOUT(4) << "Initialising OIS components..." << std::endl;
-
-            // store handle internally so we can reload OIS
-            windowHnd_ = windowHnd;
-
-            OIS::ParamList paramList;
-            std::ostringstream windowHndStr;
-
-            // Fill parameter list
-            windowHndStr << (unsigned int)windowHnd_;
-            paramList.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
+    void InputManager::loadDevices(size_t windowHnd, unsigned int windowWidth, unsigned int windowHeight)
+    {
+        CCOUT(3) << "Loading input devices..." << std::endl;
+
+        // When loading the devices they should not already be loaded
+        assert(internalState_ & Bad);
+        assert(devices_[InputDeviceEnumerator::Mouse] == 0);
+        assert(devices_[InputDeviceEnumerator::Keyboard] == 0);
+        assert(devices_.size() == InputDeviceEnumerator::FirstJoyStick);
+
+        // store handle internally so we can reload OIS
+        windowHnd_ = windowHnd;
+
+        OIS::ParamList paramList;
+        std::ostringstream windowHndStr;
+
+        // Fill parameter list
+        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")));
-            //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")));
+        //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")));
+        //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"));
-            paramList.insert(std::make_pair(std::string("x11_mouse_hide"), "true"));
-            bool kbNoGrab;
-            CommandLine::getValue("keyboard_no_grab", &kbNoGrab);
-            if (kbNoGrab)
-                paramList.insert(std::make_pair(std::string("x11_keyboard_grab"), std::string("false")));
+        paramList.insert(std::make_pair(std::string("XAutoRepeatOn"), std::string("true")));
+        paramList.insert(std::make_pair(std::string("x11_mouse_grab"), "true"));
+        paramList.insert(std::make_pair(std::string("x11_mouse_hide"), "true"));
+        bool kbNoGrab;
+        CommandLine::getValue("keyboard_no_grab", &kbNoGrab);
+        if (kbNoGrab)
+            paramList.insert(std::make_pair(std::string("x11_keyboard_grab"), std::string("false")));
+        else
+            paramList.insert(std::make_pair(std::string("x11_keyboard_grab"), std::string("true")));
+#endif
+
+        try
+        {
+            oisInputManager_ = OIS::InputManager::createInputSystem(paramList);
+            // Exception-safety
+            Loki::ScopeGuard guard = Loki::MakeGuard(OIS::InputManager::destroyInputSystem, oisInputManager_);
+            CCOUT(ORX_DEBUG) << "Created OIS input manager." << std::endl;
+
+            if (oisInputManager_->getNumberOfDevices(OIS::OISKeyboard) > 0)
+                devices_[InputDeviceEnumerator::Keyboard] = new Keyboard(InputDeviceEnumerator::Keyboard);
             else
-                paramList.insert(std::make_pair(std::string("x11_keyboard_grab"), std::string("true")));
-#endif
-
-            // TODO: clean this up
-            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());
-            }
-
-            // TODO: Remove the two parameters
-            _initialiseMouse(windowWidth, windowHeight);
-
-            _initialiseJoySticks();
-
-            // clear all buffers
-            clearBuffers();
-
-            internalState_ |= OISReady;
-
-            CCOUT(ORX_DEBUG) << "Initialising OIS components done." << std::endl;
-        }
-        else
-        {
-            CCOUT(2) << "Warning: OIS compoments already initialised, skipping" << std::endl;
-        }
-
-        if (!(internalState_ & InternalsReady))
-        {
-            CCOUT(4) << "Initialising InputStates components..." << std::endl;
-
-            // Lowest priority empty InputState
-            stateEmpty_ = createInputState("empty", false, false, InputStatePriority::Empty);
-            stateEmpty_->setHandler(&InputHandler::EMPTY);
-            activeStates_[stateEmpty_->getPriority()] = stateEmpty_;
-
-            // KeyDetector to evaluate a pressed key's name
-            InputState* detector = createInputState("detector", false, false, InputStatePriority::Detector);
-            FunctorMember<InputManager>* bufferFunctor = createFunctor(&InputManager::clearBuffers);
-            bufferFunctor->setObject(this);
-            detector->setLeaveFunctor(bufferFunctor);
-            keyDetector_ = new KeyDetector();
-            detector->setHandler(keyDetector_);
-
-            // Joy stick calibration helper callback
-            InputState* calibrator = createInputState("calibrator", false, false, InputStatePriority::Calibrator);
-            calibrator->setHandler(&InputHandler::EMPTY);
-            calibratorCallbackBuffer_ = new InputBuffer();
-            calibratorCallbackBuffer_->registerListener(this, &InputManager::_stopCalibration, '\r', true);
-            calibrator->setKeyHandler(calibratorCallbackBuffer_);
-
-            internalState_ |= InternalsReady;
-
-            CCOUT(4) << "Initialising InputStates complete." << std::endl;
-        }
-
-        _updateActiveStates();
-
-        CCOUT(3) << "Initialising complete." << std::endl;
-    }
-
-    void InputManager::_initialiseKeyboard()
-    {
-        assert(devices_[InputDeviceEnumerator::Keyboard] == 0);
-        if (inputSystem_->getNumberOfDevices(OIS::OISKeyboard) > 0)
-            devices_[InputDeviceEnumerator::Keyboard] = new Keyboard(InputDeviceEnumerator::Keyboard);
-        else
-            ThrowException(InitialisationFailed, "InputManager: No keyboard found, cannot proceed!");
-    }
-
-    void InputManager::_initialiseMouse(unsigned int windowWidth, unsigned int windowHeight)
-    {
-        assert(devices_[InputDeviceEnumerator::Mouse] == 0);
-        if (inputSystem_->getNumberOfDevices(OIS::OISMouse) > 0)
+                ThrowException(InitialisationFailed, "InputManager: No keyboard found, cannot proceed!");
+
+            // Successful initialisation
+            guard.Dismiss();
+        }
+        catch (std::exception& ex)
+        {
+            oisInputManager_ = NULL;
+            internalState_ |= Bad;
+            ThrowException(InitialisationFailed, "Could not initialise the input system: " << ex.what());
+        }
+
+        // TODO: Remove the two parameters
+        this->loadMouse(windowWidth, windowHeight);
+        this->loadJoySticks();
+
+        // Reorder states in case some joy sticks were added/removed
+        this->updateActiveStates();
+
+        CCOUT(3) << "Input devices loaded." << std::endl;
+    }
+
+    void InputManager::loadMouse(unsigned int windowWidth, unsigned int windowHeight)
+    {
+        if (oisInputManager_->getNumberOfDevices(OIS::OISMouse) > 0)
         {
             try
@@ -274,9 +268,7 @@
         False joy stick stay uninitialised, true otherwise.
     */
-    void InputManager::_initialiseJoySticks()
-    {
-        assert(devices_.size() == InputDeviceEnumerator::FirstJoyStick);
-
-        for (int i = 0; i < inputSystem_->getNumberOfDevices(OIS::OISJoyStick); i++)
+    void InputManager::loadJoySticks()
+    {
+        for (int i = 0; i < oisInputManager_->getNumberOfDevices(OIS::OISJoyStick); i++)
         {
             try
@@ -295,23 +287,27 @@
     }
 
-    void InputManager::_startCalibration()
-    {
-        BOOST_FOREACH(InputDevice* device, devices_)
-            device->startCalibration();
-
-        getInstance().internalState_ |= Calibrating;
-        getInstance().requestEnterState("calibrator");
-    }
-
-    void InputManager::_stopCalibration()
-    {
-        BOOST_FOREACH(InputDevice* device, devices_)
-            device->stopCalibration();
-
-        // restore old input state
-        requestLeaveState("calibrator");
-        internalState_ &= ~Calibrating;
-        // Clear buffers to prevent button hold events
-        this->clearBuffers();
+    /**
+    @brief
+        Checks whether there is already a joy stick with the given ID string.
+    @return
+        Returns true if ID is ok (unique), false otherwise.
+    */
+    bool InputManager::checkJoyStickID(const std::string& idString) const
+    {
+        for (unsigned int i = InputDeviceEnumerator::FirstJoyStick; i < devices_.size(); ++i)
+            if (static_cast<JoyStick*>(devices_[i])->getIDString() == idString)
+                return false;
+        return true;
+    }
+
+    /**
+    @brief
+        Sets the the name of the command used by the KeyDetector as callback.
+    @param command
+        Command name as string
+    */
+    void InputManager::setKeyDetectorCallback(const std::string& command)
+    {
+        this->keyDetector_->setCallbackCommand(command);
     }
 
@@ -328,69 +324,61 @@
     InputManager::~InputManager()
     {
-        if (internalState_ != Uninitialised)
-        {
-            CCOUT(3) << "Destroying ..." << std::endl;
-
-            // 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
-            BOOST_FOREACH(InputDevice*& device, devices_)
-            {
-                std::string className = device->getClassName();
-                try
-                {
-                    if (device)
-                        delete device;
-                    device = 0;
-                    CCOUT(4) << className << " destroyed." << std::endl;
-                }
-                catch (...)
-                {
-                    CCOUT(1) << className << " destruction failed! Potential resource leak!" << std::endl;
-                }
-            }
-            devices_.resize(InputDeviceEnumerator::FirstJoyStick);
-
+        CCOUT(4) << "Destroying..." << std::endl;
+
+        // Destroy calibrator helper handler and state
+        delete keyDetector_;
+        this->destroyState("calibrator");
+        // Destroy KeyDetector and state
+        delete calibratorCallbackHandler_;
+        this->destroyState("detector");
+        // destroy the empty InputState
+        this->destroyStateInternal(this->emptyState_);
+
+        // destroy all user InputStates
+        while (statesByName_.size() > 0)
+            this->destroyStateInternal((*statesByName_.rbegin()).second);
+
+        if (!(internalState_ & Bad))
+            this->destroyDevices();
+
+        CCOUT(4) << "Destruction complete." << std::endl;
+        singletonRef_s = 0;
+    }
+
+    void InputManager::destroyDevices()
+    {
+        CCOUT(3) << "Destroying devices..." << std::endl;
+
+        BOOST_FOREACH(InputDevice*& device, devices_)
+        {
+            if (device == NULL)
+                continue;
+            std::string className = device->getClassName();
             try
             {
-                OIS::InputManager::destroyInputSystem(inputSystem_);
+                delete device;
+                device = 0;
+                CCOUT(4) << className << " destroyed." << std::endl;
             }
             catch (...)
             {
-                CCOUT(1) << "OIS::InputManager destruction failed! Potential resource leak!" << std::endl;
-            }
-        }
-
-        singletonRef_s = 0;
-    }
-
-    /**
-    @brief
-        Removes and destroys an InputState.
-    @return
-        True if state was removed immediately, false if postponed.
-    */
-    void InputManager::_destroyState(InputState* state)
-    {
-        assert(state && !(this->internalState_ & Ticking));
-        std::map<int, InputState*>::iterator it = this->activeStates_.find(state->getPriority());
-        if (it != this->activeStates_.end())
-        {
-            this->activeStates_.erase(it);
-            _updateActiveStates();
-        }
-        inputStatesByName_.erase(state->getName());
-        delete state;
+                CCOUT(1) << className << " destruction failed! Potential resource leak!" << std::endl;
+            }
+        }
+        devices_.resize(InputDeviceEnumerator::FirstJoyStick);
+
+        assert(oisInputManager_ != NULL);
+        try
+        {
+            OIS::InputManager::destroyInputSystem(oisInputManager_);
+        }
+        catch (...)
+        {
+            CCOUT(1) << "OIS::InputManager destruction failed! Potential resource leak!" << std::endl;
+        }
+        oisInputManager_ = NULL;
+
+        internalState_ |= Bad;
+        CCOUT(3) << "Destroyed devices." << std::endl;
     }
 
@@ -405,20 +393,17 @@
         include the update() method.
     */
-    void InputManager::reloadInputSystem()
+    void InputManager::reload()
     {
         if (internalState_ & Ticking)
         {
             // We cannot destroy OIS right now, because reload was probably
-            // caused by a user clicking on a GUI item. The backtrace would then
+            // caused by a user clicking on a GUI item. The stack trace would then
             // include an OIS method. So it would be a very bad thing to destroy it..
             internalState_ |= ReloadRequest;
         }
-        else if (internalState_ & OISReady)
-            _reload();
+        else if (internalState_ & Calibrating)
+            CCOUT(2) << "Warning: Cannot reload input system. Joy sticks are currently being calibrated." << std::endl;
         else
-        {
-            CCOUT(2) << "Warning: Cannot reload OIS. May not yet be initialised or"
-                     << "joy sticks are currently calibrating." << std::endl;
-        }
+            reloadInternal();
     }
 
@@ -427,48 +412,23 @@
         Internal reload method. Destroys the OIS devices and loads them again.
     */
-    void InputManager::_reload()
-    {
-        try
-        {
-            CCOUT(3) << "Reloading ..." << std::endl;
-
-            // Save mouse clipping size
-            int mouseWidth  = static_cast<Mouse*>(devices_[InputDeviceEnumerator::Mouse])->getClippingWidth();
-            int mouseHeight = static_cast<Mouse*>(devices_[InputDeviceEnumerator::Mouse])->getClippingHeight();
-
-            internalState_ &= ~OISReady;
-
-            // destroy the devices
-            // destroy the devices
-            BOOST_FOREACH(InputDevice*& device, devices_)
-            {
-                try
-                {
-                    if (device)
-                        delete device;
-                    device = 0;
-                    CCOUT(4) << device->getClassName() << " destroyed." << std::endl;
-                }
-                catch (...)
-                {
-                    CCOUT(1) << device->getClassName() << " destruction failed! Potential resource leak!" << std::endl;
-                }
-            }
-            devices_.resize(InputDeviceEnumerator::FirstJoyStick);
-
-            OIS::InputManager::destroyInputSystem(inputSystem_);
-            inputSystem_ = 0;
-
-            // clear all buffers containing input information
-            clearBuffers();
-
-            initialise(windowHnd_, mouseWidth, mouseHeight);
-
-            CCOUT(3) << "Reloading done." << std::endl;
-        }
-        catch (OIS::Exception& ex)
-        {
-            CCOUT(1) << "An exception has occured while reloading:\n" << ex.what() << std::endl;
-        }
+    void InputManager::reloadInternal()
+    {
+        CCOUT(3) << "Reloading ..." << std::endl;
+
+        // Save mouse clipping size
+        int clippingWidth = 800;
+        int clippingHeight = 600;
+        if (devices_[InputDeviceEnumerator::Mouse])
+        {
+            int clippingWidth  = static_cast<Mouse*>(devices_[InputDeviceEnumerator::Mouse])->getClippingWidth();
+            int clippingHeight = static_cast<Mouse*>(devices_[InputDeviceEnumerator::Mouse])->getClippingHeight();
+        }
+
+        this->destroyDevices();
+        this->loadDevices(windowHnd_, clippingWidth, clippingHeight);
+
+        internalState_ &= ~Bad;
+        internalState_ &= ~ReloadRequest;
+        CCOUT(3) << "Reloading complete." << std::endl;
     }
 
@@ -486,11 +446,9 @@
     void InputManager::update(const Clock& time)
     {
-        if (internalState_ == Uninitialised)
-            return;
+        if (internalState_ & Bad)
+            ThrowException(General, "InputManager was not correctly reloaded.");
+
         else if (internalState_ & ReloadRequest)
-        {
-            _reload();
-            internalState_ &= ~ReloadRequest;
-        }
+            reloadInternal();
 
         // check for states to leave
@@ -502,10 +460,10 @@
                 (*it)->left();
                 // just to be sure that the state actually is registered
-                assert(inputStatesByName_.find((*it)->getName()) != inputStatesByName_.end());
+                assert(statesByName_.find((*it)->getName()) != statesByName_.end());
 
                 activeStates_.erase((*it)->getPriority());
                 if ((*it)->getPriority() < InputStatePriority::HighPriority)
                     (*it)->setPriority(0);
-                _updateActiveStates();
+                updateActiveStates();
             }
             stateLeaveRequests_.clear();
@@ -519,5 +477,5 @@
             {
                 // just to be sure that the state actually is registered
-                assert(inputStatesByName_.find((*it)->getName()) != inputStatesByName_.end());
+                assert(statesByName_.find((*it)->getName()) != statesByName_.end());
 
                 if ((*it)->getPriority() == 0)
@@ -538,5 +496,5 @@
                 }
                 activeStates_[(*it)->getPriority()] = (*it);
-                _updateActiveStates();
+                updateActiveStates();
                 (*it)->entered();
             }
@@ -550,5 +508,5 @@
                 it != stateDestroyRequests_.end(); ++it)
             {
-                _destroyState((*it));
+                destroyStateInternal((*it));
             }
             stateDestroyRequests_.clear();
@@ -566,19 +524,17 @@
         }
         if (bUpdateRequired)
-            _updateActiveStates();
+            updateActiveStates();
 
         // mark that we now start capturing and distributing input
         internalState_ |= Ticking;
 
-        // Capture all the input. This calls the event handlers in InputManager.
+        // Capture all the input and handle it
         BOOST_FOREACH(InputDevice* device, devices_)
-            device->update(time);
-
-        if (!(internalState_ & Calibrating))
-        {
-            // update the states with a general tick afterwards
-            for (unsigned int i = 0; i < activeStatesTicked_.size(); ++i)
-                activeStatesTicked_[i]->update(time.getDeltaTime());
-        }
+            if (device != NULL)
+                device->update(time);
+
+        // Update the states
+        for (unsigned int i = 0; i < activeStatesTicked_.size(); ++i)
+            activeStatesTicked_[i]->update(time.getDeltaTime());
 
         internalState_ &= ~Ticking;
@@ -590,9 +546,11 @@
         Also, a list of all active states (no duplicates!) is compiled for the general update().
     */
-    void InputManager::_updateActiveStates()
+    void InputManager::updateActiveStates()
     {
         // temporary resize
         for (unsigned int i = 0; i < devices_.size(); ++i)
         {
+            if (devices_[i] == NULL)
+                continue;
             std::vector<InputState*>& states = devices_[i]->getStateListRef();
             bool occupied = false;
@@ -613,6 +571,7 @@
         std::set<InputState*> tempSet;
         for (unsigned int i = 0; i < devices_.size(); ++i)
-            for (unsigned int iState = 0; iState < devices_[i]->getStateListRef().size(); ++iState)
-                tempSet.insert(devices_[i]->getStateListRef()[iState]);
+            if (devices_[i] != NULL)
+                for (unsigned int iState = 0; iState < devices_[i]->getStateListRef().size(); ++iState)
+                    tempSet.insert(devices_[i]->getStateListRef()[iState]);
 
         // copy the content of the std::set back to the actual vector
@@ -629,45 +588,42 @@
     {
         BOOST_FOREACH(InputDevice* device, devices_)
-            device->clearBuffers();
-    }
-
-
-    // ############################################################
-    // #####                Friend functions                  #####
+            if (device != NULL)
+                device->clearBuffers();
+    }
+
+    /**
+    @brief
+        Starts joy stick calibration.
+    */
+    void InputManager::calibrate()
+    {
+        COUT(0) << "Move all joy stick axes fully in all directions." << std::endl
+                << "When done, put the axex in the middle position and press enter." << std::endl;
+
+        BOOST_FOREACH(InputDevice* device, devices_)
+            if (device != NULL)
+                device->startCalibration();
+
+        internalState_ |= Calibrating;
+        enterState("calibrator");
+    }
+
+    void InputManager::stopCalibration()
+    {
+        BOOST_FOREACH(InputDevice* device, devices_)
+            if (device != NULL)
+                device->stopCalibration();
+
+        // restore old input state
+        leaveState("calibrator");
+        internalState_ &= ~Calibrating;
+        // Clear buffers to prevent button hold events
+        this->clearBuffers();
+    }
+
+    // ############################################################
+    // #####                    Iput States                   #####
     // ##########                                        ##########
     // ############################################################
-
-    /**
-    @brief
-        Checks whether there is already a joy stick with the given ID string.
-    @return
-        Returns true if ID is ok (unique), false otherwise.
-    */
-    bool InputManager::checkJoyStickID(const std::string& idString) const
-    {
-        for (unsigned int i = InputDeviceEnumerator::FirstJoyStick; i < devices_.size(); ++i)
-            if (static_cast<JoyStick*>(devices_[i])->getIDString() == idString)
-                return false;
-        return true;
-    }
-
-
-    // ############################################################
-    // #####         Other Public Interface Methods           #####
-    // ##########                                        ##########
-    // ############################################################
-
-    /**
-    @brief
-        Sets the the name of the command used by the KeyDetector as callback.
-    @param command
-        Command name as string
-    */
-    void InputManager::setKeyDetectorCallback(const std::string& command)
-    {
-        this->keyDetector_->setCallbackCommand(command);
-    }
-
-    // ###### InputStates ######
 
     /**
@@ -689,5 +645,5 @@
     {
         InputState* state = new InputState;
-        if (_configureInputState(state, name, bAlwaysGetsInput, bTransparent, priority))
+        if (configureInputState(state, name, bAlwaysGetsInput, bTransparent, priority))
             return state;
         else
@@ -712,5 +668,5 @@
         True if added, false if name or priority already existed.
     */
-    bool InputManager::_configureInputState(InputState* state, const std::string& name, bool bAlwaysGetsInput, bool bTransparent, int priority)
+    bool InputManager::configureInputState(InputState* state, const std::string& name, bool bAlwaysGetsInput, bool bTransparent, int priority)
     {
         if (name == "")
@@ -718,11 +674,11 @@
         if (!state)
             return false;
-        if (inputStatesByName_.find(name) == inputStatesByName_.end())
+        if (statesByName_.find(name) == statesByName_.end())
         {
             if (priority >= InputStatePriority::HighPriority || priority == InputStatePriority::Empty)
             {
                 // Make sure we don't add two high priority states with the same priority
-                for (std::map<std::string, InputState*>::const_iterator it = this->inputStatesByName_.begin();
-                    it != this->inputStatesByName_.end(); ++it)
+                for (std::map<std::string, InputState*>::const_iterator it = this->statesByName_.begin();
+                    it != this->statesByName_.end(); ++it)
                 {
                     if (it->second->getPriority() == priority)
@@ -734,5 +690,5 @@
                 }
             }
-            inputStatesByName_[name] = state;
+            statesByName_[name] = state;
             state->JoyStickQuantityChanged(devices_.size() - InputDeviceEnumerator::FirstJoyStick);
             state->setName(name);
@@ -752,44 +708,4 @@
     /**
     @brief
-        Removes and destroys an input state internally.
-    @param name
-        Name of the handler.
-    @return
-        True if removal was successful, false if name was not found.
-    @remarks
-        You can't remove the internal states "empty", "calibrator" and "detector".
-        The removal process is being postponed if InputManager::update() is currently running.
-    */
-    bool InputManager::requestDestroyState(const std::string& name)
-    {
-        if (name == "empty")
-        {
-            COUT(2) << "InputManager: Removing the empty state is not allowed!" << std::endl;
-            return false;
-        }
-        std::map<std::string, InputState*>::iterator it = inputStatesByName_.find(name);
-        if (it != inputStatesByName_.end())
-        {
-            if (activeStates_.find(it->second->getPriority()) != activeStates_.end())
-            {
-                // The state is still active. We have to postpone
-                stateLeaveRequests_.insert(it->second);
-                stateDestroyRequests_.insert(it->second);
-            }
-            else if (this->internalState_ & Ticking)
-            {
-                // cannot remove state while ticking
-                stateDestroyRequests_.insert(it->second);
-            }
-            else
-                _destroyState(it->second);
-
-            return true;
-        }
-        return false;
-    }
-
-    /**
-    @brief
         Returns the pointer to the requested InputState.
     @param name
@@ -800,20 +716,9 @@
     InputState* InputManager::getState(const std::string& name)
     {
-        std::map<std::string, InputState*>::iterator it = inputStatesByName_.find(name);
-        if (it != inputStatesByName_.end())
+        std::map<std::string, InputState*>::iterator it = statesByName_.find(name);
+        if (it != statesByName_.end())
             return it->second;
         else
             return 0;
-    }
-
-    /**
-    @brief
-        Returns the current input state (there might be others active too!)
-    @return
-        The current highest prioritised active input state.
-    */
-    InputState* InputManager::getCurrentState()
-    {
-        return (*activeStates_.rbegin()).second;
     }
 
@@ -827,9 +732,9 @@
         False if name was not found, true otherwise.
     */
-    bool InputManager::requestEnterState(const std::string& name)
+    bool InputManager::enterState(const std::string& name)
     {
         // get pointer from the map with all stored handlers
-        std::map<std::string, InputState*>::const_iterator it = inputStatesByName_.find(name);
-        if (it != inputStatesByName_.end())
+        std::map<std::string, InputState*>::const_iterator it = statesByName_.find(name);
+        if (it != statesByName_.end())
         {
             // exists
@@ -857,5 +762,5 @@
         False if name was not found, true otherwise.
     */
-    bool InputManager::requestLeaveState(const std::string& name)
+    bool InputManager::leaveState(const std::string& name)
     {
         if (name == "empty")
@@ -865,6 +770,6 @@
         }
         // get pointer from the map with all stored handlers
-        std::map<std::string, InputState*>::const_iterator it = inputStatesByName_.find(name);
-        if (it != inputStatesByName_.end())
+        std::map<std::string, InputState*>::const_iterator it = statesByName_.find(name);
+        if (it != statesByName_.end())
         {
             // exists
@@ -879,29 +784,59 @@
     }
 
-
-    // ############################################################
-    // #####                Console Commands                  #####
-    // ##########                                        ##########
-    // ############################################################
-
-    /**
-    @brief
-        Starts joy stick calibration.
-    */
-    void InputManager::calibrate()
-    {
-        COUT(0) << "Move all joy stick axes fully in all directions." << std::endl
-                << "When done, put the axex in the middle position and press enter." << std::endl;
-
-        getInstance()._startCalibration();
-    }
-
-    /**
-    @brief
-        Reloads the input system
-    */
-    void InputManager::reload()
-    {
-        getInstance().reloadInputSystem();
+    /**
+    @brief
+        Removes and destroys an input state.
+    @param name
+        Name of the handler.
+    @return
+        True if removal was successful, false if name was not found.
+    @remarks
+        You can't remove the internal states "empty", "calibrator" and "detector".
+        The removal process is being postponed if InputManager::update() is currently running.
+    */
+    bool InputManager::destroyState(const std::string& name)
+    {
+        if (name == "empty")
+        {
+            COUT(2) << "InputManager: Removing the empty state is not allowed!" << std::endl;
+            return false;
+        }
+        std::map<std::string, InputState*>::iterator it = statesByName_.find(name);
+        if (it != statesByName_.end())
+        {
+            if (activeStates_.find(it->second->getPriority()) != activeStates_.end())
+            {
+                // The state is still active. We have to postpone
+                stateLeaveRequests_.insert(it->second);
+                stateDestroyRequests_.insert(it->second);
+            }
+            else if (this->internalState_ & Ticking)
+            {
+                // cannot remove state while ticking
+                stateDestroyRequests_.insert(it->second);
+            }
+            else
+                destroyStateInternal(it->second);
+
+            return true;
+        }
+        return false;
+    }
+
+    /**
+    @brief
+        Destroys an InputState internally
+    */
+    void InputManager::destroyStateInternal(InputState* state)
+    {
+        assert(state && !(this->internalState_ & Ticking));
+        std::map<int, InputState*>::iterator it = this->activeStates_.find(state->getPriority());
+        if (it != this->activeStates_.end())
+        {
+            this->activeStates_.erase(it);
+            updateActiveStates();
+        }
+        statesByName_.erase(state->getName());
+        delete state;
     }
 }
Index: /code/branches/core4/src/core/input/InputManager.h
===================================================================
--- /code/branches/core4/src/core/input/InputManager.h	(revision 3278)
+++ /code/branches/core4/src/core/input/InputManager.h	(revision 3279)
@@ -44,23 +44,9 @@
 #include <vector>
 
-#include "util/Math.h"
-#include "util/OrxEnum.h"
 #include "core/OrxonoxClass.h"
+#include "InputState.h"
 
 namespace orxonox
 {
-    struct InputStatePriority : OrxEnum<InputStatePriority>
-    {
-        OrxEnumConstructors(InputStatePriority);
-
-        static const int Empty        = -1;
-        static const int Dynamic      = 0;
-
-        static const int HighPriority = 1000;
-        static const int Console      = HighPriority + 0;
-        static const int Calibrator   = HighPriority + 1;
-        static const int Detector     = HighPriority + 2;
-    };
-
     /**
     @brief
@@ -69,51 +55,43 @@
     class _CoreExport InputManager : public OrxonoxClass
     {
-        // --> setConfigValues is private
-        friend class ClassIdentifier<InputManager>;
-
     public:
-        enum InputManagerState
+        enum State
         {
-            Uninitialised    = 0x00,
-            OISReady         = 0x01,
-            InternalsReady   = 0x02,
-            Ticking          = 0x04,
-            Calibrating      = 0x08,
-            ReloadRequest    = 0x10,
+            Nothing       = 0x00,
+            Bad           = 0x02,
+            Ticking       = 0x04,
+            Calibrating   = 0x08,
+            ReloadRequest = 0x10,
         };
 
         InputManager (size_t windowHnd, unsigned int windowWidth, unsigned int windowHeight);
         ~InputManager();
+        void setConfigValues();
 
-        void initialise(size_t windowHnd, unsigned int windowWidth, unsigned int windowHeight);
+        void update(const Clock& time);
+        void clearBuffers();
+        void calibrate();
+        void reload();
 
-        void reloadInputSystem();
+        //-------------------------------
+        // Input States
+        //-------------------------------
+        InputState* createInputState(const std::string& name, bool bAlwaysGetsInput = false, bool bTransparent = false, InputStatePriority priority = InputStatePriority::Dynamic);
+        InputState* getState(const std::string& name);
+        bool enterState     (const std::string& name);
+        bool leaveState     (const std::string& name);
+        bool destroyState   (const std::string& name);
 
-        void clearBuffers();
-
-        void setWindowExtents(const int width, const int height);
+        //-------------------------------
+        // Various getters and setters
+        //-------------------------------
         void setKeyDetectorCallback(const std::string& command);
-
-        InputState* createInputState(const std::string& name, bool bAlwaysGetsInput = false, bool bTransparent = false, InputStatePriority priority = InputStatePriority::Dynamic);
-
-        InputState* getState       (const std::string& name);
-        InputState* getCurrentState();
-        bool requestDestroyState   (const std::string& name);
-        bool requestEnterState     (const std::string& name);
-        bool requestLeaveState     (const std::string& name);
-
-        OIS::InputManager* getInputSystem() { return this->inputSystem_; }
         bool checkJoyStickID(const std::string& idString) const;
         unsigned int getJoyStickQuantity() const
             { return devices_.size() - InputDeviceEnumerator::FirstJoyStick; }
-
-        void update(const Clock& time);
+        OIS::InputManager* getOISInputManager()
+            { return this->oisInputManager_; }
 
         static InputManager& getInstance()    { assert(singletonRef_s); return *singletonRef_s; }
-        static InputManager* getInstancePtr() { return singletonRef_s; }
-
-        // console commands
-        static void calibrate();
-        static void reload();
 
     private: // functions
@@ -122,39 +100,35 @@
 
         // Intenal methods
-        void _initialiseKeyboard();
-        void _initialiseMouse(unsigned int windowWidth, unsigned int windowHeight);
-        void _initialiseJoySticks();
+        void loadDevices(size_t windowHnd, unsigned int windowWidth, unsigned int windowHeight);
+        void loadMouse(unsigned int windowWidth, unsigned int windowHeight);
+        void loadJoySticks();
+        void destroyDevices();
 
-        void _startCalibration();
-        void _stopCalibration();
+        void stopCalibration();
 
-        void _destroyState(InputState* state);
+        void destroyStateInternal(InputState* state);
+        void updateActiveStates();
+        bool configureInputState(InputState* state, const std::string& name, bool bAlwaysGetsInput, bool bTransparent, int priority);
 
-        void _reload();
-
-        void _updateActiveStates();
-        bool _configureInputState(InputState* state, const std::string& name, bool bAlwaysGetsInput, bool bTransparent, int priority);
-
-        void setConfigValues();
+        void reloadInternal();
 
     private: // variables
-        OIS::InputManager*                  inputSystem_;          //!< OIS input manager
+        State                               internalState_;        //!< Current internal state
+        OIS::InputManager*                  oisInputManager_;      //!< OIS input manager
         std::vector<InputDevice*>           devices_;              //!< List of all input devices (keyboard, mouse, joy sticks)
         size_t                              windowHnd_;            //!< Render window handle
-        InputManagerState                   internalState_;        //!< Current internal state
 
         // some internally handled states and handlers
-        InputState*                         stateEmpty_;
+        InputState*                         emptyState_;
         KeyDetector*                        keyDetector_;          //!< KeyDetector instance
-        InputBuffer*                        calibratorCallbackBuffer_;
+        InputBuffer*                        calibratorCallbackHandler_;
 
-        std::map<std::string, InputState*>  inputStatesByName_;
+        std::map<std::string, InputState*>  statesByName_;
+        std::map<int, InputState*>          activeStates_;
+        std::vector<InputState*>            activeStatesTicked_;
 
         std::set<InputState*>               stateEnterRequests_;   //!< Request to enter a new state
         std::set<InputState*>               stateLeaveRequests_;   //!< Request to leave a running state
         std::set<InputState*>               stateDestroyRequests_; //!< Request to destroy a state
-
-        std::map<int, InputState*>          activeStates_;
-        std::vector<InputState*>            activeStatesTicked_;
 
         static InputManager*                singletonRef_s;
Index: /code/branches/core4/src/core/input/InputState.h
===================================================================
--- /code/branches/core4/src/core/input/InputState.h	(revision 3278)
+++ /code/branches/core4/src/core/input/InputState.h	(revision 3279)
@@ -36,4 +36,5 @@
 #include <vector>
 
+#include "util/OrxEnum.h"
 #include "InputHandler.h"
 #include "JoyStickQuantityListener.h"
@@ -41,4 +42,17 @@
 namespace orxonox
 {
+    struct InputStatePriority : OrxEnum<InputStatePriority>
+    {
+        OrxEnumConstructors(InputStatePriority);
+
+        static const int Empty        = -1;
+        static const int Dynamic      = 0;
+
+        static const int HighPriority = 1000;
+        static const int Console      = HighPriority + 0;
+        static const int Calibrator   = HighPriority + 1;
+        static const int Detector     = HighPriority + 2;
+    };
+
     class _CoreExport InputState : public JoyStickQuantityListener
     {
Index: /code/branches/core4/src/core/input/KeyBinder.cc
===================================================================
--- /code/branches/core4/src/core/input/KeyBinder.cc	(revision 3278)
+++ /code/branches/core4/src/core/input/KeyBinder.cc	(revision 3279)
@@ -56,4 +56,7 @@
         mousePosition_[0] = 0;
         mousePosition_[1] = 0;
+
+        joyStickButtons_.reserve(1000);
+        joyStickAxes_.reserve(1000);
 
         RegisterRootObject(KeyBinder);
Index: /code/branches/core4/src/orxonox/gamestates/GSGraphics.cc
===================================================================
--- /code/branches/core4/src/orxonox/gamestates/GSGraphics.cc	(revision 3278)
+++ /code/branches/core4/src/orxonox/gamestates/GSGraphics.cc	(revision 3279)
@@ -150,5 +150,5 @@
 
         // enable master input
-        InputManager::getInstance().requestEnterState("master");
+        InputManager::getInstance().enterState("master");
     }
 
@@ -170,5 +170,5 @@
 
         masterInputState_->setHandler(0);
-        InputManager::getInstance().requestDestroyState("master");
+        InputManager::getInstance().destroyState("master");
         delete this->masterKeyBinder_;
 
Index: /code/branches/core4/src/orxonox/gamestates/GSLevel.cc
===================================================================
--- /code/branches/core4/src/orxonox/gamestates/GSLevel.cc	(revision 3278)
+++ /code/branches/core4/src/orxonox/gamestates/GSLevel.cc	(revision 3279)
@@ -134,5 +134,5 @@
 
             // level is loaded: we can start capturing the input
-            InputManager::getInstance().requestEnterState("game");
+            InputManager::getInstance().enterState("game");
         }
     }
@@ -144,5 +144,5 @@
             GUIManager::getInstance().showGUI("inGameTest");
             GUIManager::getInstance().executeCode("showCursor()");
-            InputManager::getInstance().requestEnterState("guiMouseOnly");
+            InputManager::getInstance().enterState("guiMouseOnly");
         }
         else
@@ -150,5 +150,5 @@
             GUIManager::getInstance().executeCode("hideGUI(\"inGameTest\")");
             GUIManager::getInstance().executeCode("hideCursor()");
-            InputManager::getInstance().requestLeaveState("guiMouseOnly");
+            InputManager::getInstance().leaveState("guiMouseOnly");
         }
     }
@@ -178,5 +178,5 @@
 
         if (GameMode::showsGraphics())
-            InputManager::getInstance().requestLeaveState("game");
+            InputManager::getInstance().leaveState("game");
 
         if (GameMode::isMaster())
@@ -218,5 +218,5 @@
             guiMouseOnlyInputState_->setHandler(0);
             guiKeysOnlyInputState_->setHandler(0);
-            InputManager::getInstance().requestDestroyState("game");
+            InputManager::getInstance().destroyState("game");
             if (this->keyBinder_)
             {
@@ -286,5 +286,5 @@
                 {
                     COUT(0) << "Press any button/key or move a mouse/joystick axis" << std::endl;
-                    InputManager::getInstance().requestEnterState("detector");
+                    InputManager::getInstance().enterState("detector");
                     bindingString = command;
                     bTemporarySaved = bTemporary;
@@ -301,5 +301,5 @@
                     COUT(0) << "Binding string \"" << bindingString << "\" on key '" << name << "'" << std::endl;
                     this->keyBinder_->setBinding(bindingString, name, bTemporarySaved);
-                    InputManager::getInstance().requestLeaveState("detector");
+                    InputManager::getInstance().leaveState("detector");
                     bound = true;
                 }
Index: /code/branches/core4/src/orxonox/gamestates/GSMainMenu.cc
===================================================================
--- /code/branches/core4/src/orxonox/gamestates/GSMainMenu.cc	(revision 3278)
+++ /code/branches/core4/src/orxonox/gamestates/GSMainMenu.cc	(revision 3279)
@@ -96,5 +96,5 @@
         }
 
-        InputManager::getInstance().requestEnterState("mainMenu");
+        InputManager::getInstance().enterState("mainMenu");
 
         this->ambient_ = new SoundMainMenu();
@@ -106,6 +106,6 @@
         delete this->ambient_;
 
-        InputManager::getInstance().requestLeaveState("mainMenu");
-        InputManager::getInstance().requestDestroyState("mainMenu");
+        InputManager::getInstance().leaveState("mainMenu");
+        InputManager::getInstance().destroyState("mainMenu");
 
         GUIManager::getInstance().setCamera(0);
Index: /code/branches/core4/src/orxonox/objects/pickup/PickupInventory.cc
===================================================================
--- /code/branches/core4/src/orxonox/objects/pickup/PickupInventory.cc	(revision 3278)
+++ /code/branches/core4/src/orxonox/objects/pickup/PickupInventory.cc	(revision 3279)
@@ -88,5 +88,5 @@
             GUIManager::getInstance().executeCode("hideGUI(\"PickupInventory\")");
             GUIManager::getInstance().executeCode("hideCursor()");
-            InputManager::getInstance().requestLeaveState("guiMouseOnly");
+            InputManager::getInstance().leaveState("guiMouseOnly");
         }
         else
@@ -94,5 +94,5 @@
             GUIManager::getInstance().showGUI("PickupInventory");
             GUIManager::getInstance().executeCode("showCursor()");
-            InputManager::getInstance().requestEnterState("guiMouseOnly");
+            InputManager::getInstance().enterState("guiMouseOnly");
         }
         PickupInventory::getSingleton()->setVisible(!PickupInventory::getSingleton()->isVisible());
Index: /code/branches/core4/src/orxonox/overlays/GUIOverlay.cc
===================================================================
--- /code/branches/core4/src/orxonox/overlays/GUIOverlay.cc	(revision 3278)
+++ /code/branches/core4/src/orxonox/overlays/GUIOverlay.cc	(revision 3279)
@@ -70,5 +70,5 @@
             str = out.str();
             GUIManager::getInstance().executeCode("showCursor()");
-            InputManager::getInstance().requestEnterState("guiMouseOnly");
+            InputManager::getInstance().enterState("guiMouseOnly");
             GUIManager::getInstance().executeCode("showGUI(\"" + this->guiName_ + "\", " + str + ")");
         }
@@ -77,5 +77,5 @@
             GUIManager::getInstance().executeCode("hideGUI(\"" + this->guiName_ + "\")");
             GUIManager::getInstance().executeCode("hideCursor()");
-            InputManager::getInstance().requestLeaveState("guiMouseOnly");
+            InputManager::getInstance().leaveState("guiMouseOnly");
         }
     }
Index: /code/branches/core4/src/orxonox/overlays/console/InGameConsole.cc
===================================================================
--- /code/branches/core4/src/orxonox/overlays/console/InGameConsole.cc	(revision 3278)
+++ /code/branches/core4/src/orxonox/overlays/console/InGameConsole.cc	(revision 3279)
@@ -98,5 +98,5 @@
 
         // destroy the input state previously created (InputBuffer gets destroyed by the Shell)
-        InputManager::getInstance().requestDestroyState("console");
+        InputManager::getInstance().destroyState("console");
 
         Ogre::OverlayManager* ovMan = Ogre::OverlayManager::getSingletonPtr();
@@ -507,5 +507,5 @@
         {
             this->bActive_ = true;
-            InputManager::getInstance().requestEnterState("console");
+            InputManager::getInstance().enterState("console");
             Shell::getInstance().registerListener(this);
 
@@ -529,5 +529,5 @@
         {
             this->bActive_ = false;
-            InputManager::getInstance().requestLeaveState("console");
+            InputManager::getInstance().leaveState("console");
             Shell::getInstance().unregisterListener(this);
 
