Index: code/branches/input/src/core/Debug.h
===================================================================
--- code/branches/input/src/core/Debug.h	(revision 1182)
+++ code/branches/input/src/core/Debug.h	(revision 1193)
@@ -264,4 +264,10 @@
 ///  CCOUT: Prints output with std::cout and adds the classname   ///
 /////////////////////////////////////////////////////////////////////
+#define CCOUTORX_NONE    CCOUT0
+#define CCOUTORX_ERROR   CCOUT1
+#define CCOUTORX_WARNING CCOUT2
+#define CCOUTORX_INFO    CCOUT3
+#define CCOUTORX_DEBUG   CCOUT4
+#define CCOUTORX_vDEBUG  CCOUT5
 
 #define CCOUT_EXEC(x) \
Index: code/branches/input/src/core/InputBuffer.h
===================================================================
--- code/branches/input/src/core/InputBuffer.h	(revision 1182)
+++ code/branches/input/src/core/InputBuffer.h	(revision 1193)
@@ -35,9 +35,5 @@
 #include <list>
 
-#ifdef WIN32
 #include <OIS/OISKeyboard.h>
-#else
-#include <OISKeyboard.h>
-#endif
 
 namespace orxonox
Index: code/branches/input/src/core/InputManager.cc
===================================================================
--- code/branches/input/src/core/InputManager.cc	(revision 1182)
+++ code/branches/input/src/core/InputManager.cc	(revision 1193)
@@ -28,7 +28,7 @@
 
 /**
- @file
- @brief Implementation of a little Input handler that distributes everything
-        coming from OIS.
+  @file
+  @brief Implementation of the InputManager that captures all the input from OIS
+         and redirects it to listeners if necessary.
  */
 
@@ -42,6 +42,11 @@
 namespace orxonox
 {
-  /**
-    @brief Constructor only resets the pointer values to 0.
+  // ###############################
+  // ###    Internal Methods     ###
+  // ###############################
+
+  /**
+    @brief Constructor only sets member fields to initial zero values
+           and registers the class in the class hierarchy.
   */
   InputManager::InputManager() :
@@ -49,4 +54,8 @@
       state_(IS_UNINIT), stateRequest_(IS_UNINIT)
   {
+    // overwrite every key binding with ""
+    _clearBindings();
+    _setNumberOfJoysticks(0);
+
     RegisterObject(InputManager);
   }
@@ -63,5 +72,5 @@
 
   /**
-    @brief Destructor only called at the end of the program
+    @brief Destructor only called at the end of the program, after main.
   */
   InputManager::~InputManager()
@@ -71,15 +80,17 @@
 
   /**
-    @brief Creates the OIS::InputMananger, the keyboard and the mouse and
-           assigns the key bindings.
+    @brief Creates the OIS::InputMananger, the keyboard, the mouse and
+           the joysticks and assigns the key bindings.
     @param windowHnd The window handle of the render window
     @param windowWidth The width of the render window
     @param windowHeight The height of the render window
   */
-  bool InputManager::_initialise(size_t windowHnd, int windowWidth, int windowHeight)
-  {
-    if (!inputSystem_)
-    {
-      // Setup basic variables
+  bool InputManager::_initialise(size_t windowHnd, int windowWidth, int windowHeight,
+        bool createKeyboard, bool createMouse, bool createJoySticks)
+  {
+    if (state_ == IS_UNINIT)
+    {
+      CCOUT(ORX_DEBUG) << "Initialising OIS components..." << std::endl;
+
       OIS::ParamList paramList;
       std::ostringstream windowHndStr;
@@ -95,84 +106,271 @@
       try
       {
-        // Create inputsystem
         inputSystem_ = OIS::InputManager::createInputSystem(paramList);
-        COUT(ORX_DEBUG) << "*** InputManager: Created OIS input system" << std::endl;
-
-        // create a keyboard. If none are available the exception is caught.
-        keyboard_ = static_cast<OIS::Keyboard*>(inputSystem_->createInputObject(OIS::OISKeyboard, true));
-        COUT(ORX_DEBUG) << "*** InputManager: Created OIS mouse" << std::endl;
-
-        //TODO: check for already pressed keys
-
-        // create a mouse. If none are available the exception is caught.
-        mouse_ = static_cast<OIS::Mouse*>(inputSystem_->createInputObject(OIS::OISMouse, true));
-        COUT(ORX_DEBUG) << "*** InputManager: Created OIS keyboard" << std::endl;
-
-        // Set mouse region
-        setWindowExtents(windowWidth, windowHeight);
-
-        this->state_ = IS_NONE;
+        CCOUT(ORX_DEBUG) << "Created OIS input system" << std::endl;
       }
       catch (OIS::Exception ex)
       {
-        // something went wrong with the initialisation
-        COUT(ORX_ERROR) << "Error: Failed creating an input system/keyboard/mouse. Message: \"" << ex.eText << "\"" << std::endl;
+        CCOUT(ORX_ERROR) << "Error: Failed creating an OIS input system."
+            << "OIS message: \"" << ex.eText << "\"" << std::endl;
         inputSystem_ = 0;
         return false;
       }
-    }
-
-    keyboard_->setEventCallback(this);
-    mouse_->setEventCallback(this);
-
+
+      if (createKeyboard)
+        _initialiseKeyboard();
+
+      if (createMouse)
+        _initialiseMouse();
+
+      if (createJoySticks)
+        _initialiseJoySticks();
+
+      // Set mouse/joystick region
+      setWindowExtents(windowWidth, windowHeight);
+
+      this->state_ = IS_NONE;
+      CCOUT(ORX_DEBUG) << "Initialising OIS components done." << std::endl;
+    }
+    else
+    {
+      CCOUT(ORX_WARNING) << "Warning: OIS compoments already initialised, skipping" << std::endl;
+    }
+
+    // InputManager holds the input buffer --> create one and add it.
     addKeyListener(new InputBuffer(), "buffer");
 
-    _loadBindings();
-
-    COUT(ORX_DEBUG) << "*** InputManager: Loading done." << std::endl;
-
-    return true;
-  }
-
-  void InputManager::_loadBindings()
-  {
-    for (int i = 0; i < numberOfKeys_s; i++)
-    {
-      // simply write the key number (i) in the string
-      this->bindingsKeyPress_[i] = "";
-      this->bindingsKeyRelease_[i] = "";
-    }
+    // Read all the key bindings and assign them
+    if (!_loadBindings())
+      return false;
+
+    CCOUT(ORX_DEBUG) << "Initialising complete." << std::endl;
+    return true;
+  }
+
+  /**
+    @brief Creates a keyboard and sets the event handler.
+  */
+  void InputManager::_initialiseKeyboard()
+  {
+    try
+    {
+#if (OIS_VERSION >> 8) == 0x0100
+    if (inputSystem_->numKeyboards() > 0)
+#elif (OIS_VERSION >> 8) == 0x0102
+    if (inputSystem_->getNumberOfDevices(OIS::OISKeyboard) > 0)
+#endif
+      {
+        keyboard_ = (OIS::Keyboard*)inputSystem_->createInputObject(OIS::OISKeyboard, true);
+        // register our listener in OIS.
+        keyboard_->setEventCallback(this);
+        // note: OIS will not detect keys that have already been down when the keyboard was created.
+        CCOUT(ORX_DEBUG) << "Created OIS keyboard" << std::endl;
+      }
+      else
+        CCOUT(ORX_WARNING) << "Warning: No keyboard found!" << std::endl;
+    }
+    catch (OIS::Exception ex)
+    {
+      CCOUT(ORX_WARNING) << "Warning: Failed to create an OIS keyboard\n"
+          << "OIS error message: \"" << ex.eText << "\"" << std::endl;
+      keyboard_ = 0;
+    }
+  }
+
+  /**
+    @brief Creates a mouse and sets the event handler.
+  */
+  void InputManager::_initialiseMouse()
+  {
+    try
+    {
+#if (OIS_VERSION >> 8) == 0x0100
+    if (inputSystem_->numMice() > 0)
+#elif (OIS_VERSION >> 8) == 0x0102
+    if (inputSystem_->getNumberOfDevices(OIS::OISMouse) > 0)
+#endif
+      {
+        mouse_ = static_cast<OIS::Mouse*>(inputSystem_->createInputObject(OIS::OISMouse, true));
+        // register our listener in OIS.
+        mouse_->setEventCallback(this);
+        CCOUT(ORX_DEBUG) << "Created OIS keyboard" << std::endl;
+      }
+      else
+        CCOUT(ORX_WARNING) << "Warning: No mouse found!" << std::endl;
+    }
+    catch (OIS::Exception ex)
+    {
+      CCOUT(ORX_WARNING) << "Warning: Failed to create an OIS mouse\n"
+          << "OIS error message: \"" << ex.eText << "\"" << std::endl;
+      mouse_ = 0;
+    }
+  }
+
+  /**
+    @brief Creates all joy sticks and sets the event handler.
+  */
+  void InputManager::_initialiseJoySticks()
+  {
+#if (OIS_VERSION >> 8) == 0x0100
+    if (inputSystem_->numJoySticks() > 0)
+    {
+      _setNumberOfJoysticks(inputSystem_->numJoySticks());
+#elif (OIS_VERSION >> 8) == 0x0102
+    if (inputSystem_->getNumberOfDevices(OIS::OISJoyStick) > 0)
+    {
+      _setNumberOfJoysticks(inputSystem_->getNumberOfDevices(OIS::OISJoyStick));
+#endif
+      for (std::vector<OIS::JoyStick*>::iterator it = joySticks_.begin(); it != joySticks_.end(); it++)
+      {
+        try
+        {
+          *it = static_cast<OIS::JoyStick*>(inputSystem_->createInputObject(OIS::OISJoyStick, true));
+          // register our listener in OIS.
+          (*it)->setEventCallback(this);
+          CCOUT(ORX_DEBUG) << "Created OIS joy stick with ID " << (*it)->getID() << std::endl;
+        }
+        catch (OIS::Exception ex)
+        {
+          CCOUT(ORX_WARNING) << "Warning: Failed to create OIS joy stick with ID" << (*it)->getID() << "\n"
+              << "OIS error message: \"" << ex.eText << "\"" << std::endl;
+          (*it) = 0;
+        }
+      }
+    }
+    else
+      CCOUT(ORX_WARNING) << "Warning: Joy stick support requested, but no joy stick was found" << std::endl;
+  }
+
+  /**
+    @brief Resizes all lists related to joy sticks and sets joy stick bindings to "".
+    @param size Number of joy sticks available.
+  */
+  void InputManager::_setNumberOfJoysticks(int size)
+  {
+    this->bindingsJoyStickButtonHold_   .resize(size);
+    this->bindingsJoyStickButtonPress_  .resize(size);
+    this->bindingsJoyStickButtonRelease_.resize(size);
+    this->bJoyStickButtonBindingsActive_.resize(size);
+    this->joyStickButtonsDown_          .resize(size);
+    this->joySticks_                    .resize(size);
+    for (int j = 0; j < size; j++)
+    {
+      bindingsJoyStickButtonPress_  [j].resize(numberOfJoyStickButtons_s);
+      bindingsJoyStickButtonRelease_[j].resize(numberOfJoyStickButtons_s);
+      bindingsJoyStickButtonHold_   [j].resize(numberOfJoyStickButtons_s);
+      for (int i = 0; i < numberOfJoyStickButtons_s; i++)
+      {
+        this->bindingsJoyStickButtonPress_  [j][i] = "";
+        this->bindingsJoyStickButtonRelease_[j][i] = "";
+        this->bindingsJoyStickButtonHold_   [j][i] = "";
+      }
+    }
+  }
+
+  /**
+    @brief Loads the key and button bindings.
+  */
+  bool InputManager::_loadBindings()
+  {
+    CCOUT(ORX_DEBUG) << "Loading key bindings..." << std::endl;
+
+    // clear all the bindings at first.
+    _clearBindings();
+
+    // TODO: Insert the code to load the bindings from file.
     this->bindingsKeyPress_[OIS::KC_NUMPADENTER] = "activateConsole";
     this->bindingsKeyPress_[OIS::KC_ESCAPE] = "exit";
     this->bindingsKeyHold_[OIS::KC_U] = "exec disco.txt";
-  }
-
-  /**
-    @brief Destroys all the created input devices and handlers.
+
+    CCOUT(ORX_DEBUG) << "Loading key bindings done." << std::endl;
+    return true;
+  }
+
+  /**
+    @brief Overwrites all bindings with ""
+  */
+  void InputManager::_clearBindings()
+  {
+    for (int i = 0; i < numberOfKeys_s; i++)
+    {
+      this->bindingsKeyPress_  [i] = "";
+      this->bindingsKeyRelease_[i] = "";
+      this->bindingsKeyHold_   [i] = "";
+    }
+    for (int i = 0; i < numberOfMouseButtons_s; i++)
+    {
+      this->bindingsMouseButtonPress_  [i] = "";
+      this->bindingsMouseButtonRelease_[i] = "";
+      this->bindingsMouseButtonHold_   [i] = "";
+    }
+    for (unsigned int j = 0; j < joySticks_.size(); j++)
+    {
+      for (int i = 0; i < numberOfJoyStickButtons_s; i++)
+      {
+        this->bindingsJoyStickButtonPress_  [j][i] = "";
+        this->bindingsJoyStickButtonRelease_[j][i] = "";
+        this->bindingsJoyStickButtonHold_   [j][i] = "";
+      }
+    }
+  }
+
+  /**
+    @brief Destroys all the created input devices and sets the InputManager to construction state.
   */
   void InputManager::_destroy()
   {
-    COUT(ORX_DEBUG) << "*** InputManager: Destroying ..." << std::endl;
-    if (mouse_)
-      inputSystem_->destroyInputObject(mouse_);
-    if (keyboard_)
-      inputSystem_->destroyInputObject(keyboard_);
-    if (inputSystem_)
-      OIS::InputManager::destroyInputSystem(inputSystem_);
-
-    mouse_         = 0;
-    keyboard_      = 0;
-    inputSystem_   = 0;
-
-    OIS::KeyListener* buffer = keyListeners_["buffer"];
-    if (buffer)
-    {
-      this->removeKeyListener("buffer");
-      delete buffer;
-      buffer = 0;
-    }
-
-    COUT(ORX_DEBUG) << "*** InputManager: Destroying done." << std::endl;
-  }
+    CCOUT(ORX_DEBUG) << "Destroying ..." << std::endl;
+
+    if (state_ != IS_UNINIT)
+    {
+      this->listenersKeyActive_.clear();
+      this->listenersMouseActive_.clear();
+      this->listenersJoySticksActive_.clear();
+      this->listenersKey_.clear();
+      this->listenersMouse_.clear();
+      this->listenersJoySticks_.clear();
+
+      this->keysDown_.clear();
+      this->mouseButtonsDown_.clear();
+
+      _clearBindings();
+
+      if (keyboard_)
+        inputSystem_->destroyInputObject(keyboard_);
+      keyboard_ = 0;
+
+      if (mouse_)
+        inputSystem_->destroyInputObject(mouse_);
+      mouse_ = 0;
+
+      if (joySticks_.size() > 0)
+      {
+        for (unsigned int i = 0; i < joySticks_.size(); i++)
+        {
+          if (joySticks_[i] != 0)
+            inputSystem_->destroyInputObject(joySticks_[i]);
+        }
+        _setNumberOfJoysticks(0);
+      }
+
+      if (inputSystem_)
+        OIS::InputManager::destroyInputSystem(inputSystem_);
+      inputSystem_ = 0;
+
+      if (listenersKey_.find("buffer") != listenersKey_.end())
+        delete listenersKey_["buffer"];
+
+      this->state_ = IS_UNINIT;
+    }
+    else
+      CCOUT(ORX_WARNING) << "Warning: Cannot be destroyed, since not initialised." << std::endl;
+
+    CCOUT(ORX_DEBUG) << "Destroying done." << std::endl;
+  }
+
+
+  // ###############################
+  // ###  Public Member Methods  ###
+  // ###############################
 
   /**
@@ -188,19 +386,45 @@
     if (state_ != stateRequest_)
     {
-      if (stateRequest_ != IS_CUSTOM)
-        _setDefaultState();
-
       switch (stateRequest_)
       {
       case IS_NORMAL:
+        this->listenersKeyActive_.clear();
+        this->listenersMouseActive_.clear();
+        this->listenersJoySticksActive_.clear();
+        this->bKeyBindingsActive_            = true;
+        this->bMouseButtonBindingsActive_    = true;
+        //this->bJoySticksButtonBindingsActive_ = true;
         break;
+
       case IS_GUI:
-        //FIXME: do stuff
+        // FIXME: do stuff
         break;
+
       case IS_CONSOLE:
-        if (this->keyListeners_.find("buffer") != this->keyListeners_.end())
-          this->activeKeyListeners_.push_back(this->keyListeners_["buffer"]);
-        this->bDefaultKeyInput = false;
+        this->listenersKeyActive_.clear();
+        this->listenersMouseActive_.clear();
+        //this->listenersJoyStickActive_.clear();
+        this->bKeyBindingsActive_            = false;
+        this->bMouseButtonBindingsActive_    = true;
+        //this->bJoyStickButtonBindingsActive_ = true;
+        if (listenersKey_.find("buffer") != listenersKey_.end())
+          listenersKeyActive_.push_back(listenersKey_["buffer"]);
+        else
+        {
+          // someone fiddled with the InputBuffer
+          CCOUT(2) << "Error: Cannot redirect input to console, InputBuffer instance missing." << std::endl;
+          this->bKeyBindingsActive_ = true;
+        }
         break;
+
+      case IS_NONE:
+        this->listenersKeyActive_.clear();
+        this->listenersMouseActive_.clear();
+        //this->listenersJoyStickActive_.clear();
+        this->bKeyBindingsActive_            = false;
+        this->bMouseButtonBindingsActive_    = false;
+        //this->bJoyStickButtonBindingsActive_ = false;
+        break;
+
       case IS_CUSTOM:
         // don't do anything
@@ -210,5 +434,5 @@
     }
 
-    // capture all the input. That calls the event handlers.
+    // Capture all the input. This calls the event handlers in InputManager.
     if (mouse_)
       mouse_->capture();
@@ -217,13 +441,13 @@
   }
 
-  void InputManager::_setDefaultState()
-  {
-    this->activeJoyStickListeners_.clear();
-    this->activeKeyListeners_.clear();
-    this->activeMouseListeners_.clear();
-    this->bDefaultKeyInput      = true;
-    this->bDefaultMouseInput    = true;
-    this->bDefaultJoyStickInput = true;
-  }
+  /*void InputManager::_setDefaultState()
+  {
+    this->listenersKeyActive_.clear();
+    this->listenersMouseActive_.clear();
+    this->listenersJoyStickActive_.clear();
+    this->bKeyBindingsActive_            = true;
+    this->bMouseButtonBindingsActive_    = true;
+    this->bJoyStickButtonBindingsActive_ = true;
+  }*/
 
 
@@ -236,5 +460,5 @@
     this->keysDown_.push_back(e.key);
 
-    if (this->bDefaultKeyInput)
+    if (this->bKeyBindingsActive_)
     {
       // find the appropriate key binding
@@ -248,5 +472,5 @@
     else
     {
-      for (std::list<OIS::KeyListener*>::const_iterator it = activeKeyListeners_.begin(); it != activeKeyListeners_.end(); it++)
+      for (std::list<OIS::KeyListener*>::const_iterator it = listenersKeyActive_.begin(); it != listenersKeyActive_.end(); it++)
         (*it)->keyPressed(e);
     }
@@ -270,5 +494,5 @@
     }
 
-    if (this->bDefaultKeyInput)
+    if (this->bKeyBindingsActive_)
     {
       // find the appropriate key binding
@@ -282,5 +506,5 @@
     else
     {
-      for (std::list<OIS::KeyListener*>::const_iterator it = activeKeyListeners_.begin(); it != activeKeyListeners_.end(); it++)
+      for (std::list<OIS::KeyListener*>::const_iterator it = listenersKeyActive_.begin(); it != listenersKeyActive_.end(); it++)
         (*it)->keyReleased(e);
     }
@@ -343,4 +567,7 @@
 
 
+  // ################################
+  // ### Static Interface Methods ###
+  // ################################
 
   /**
@@ -352,8 +579,11 @@
   void InputManager::setWindowExtents(int width, int height)
   {
-    // Set mouse region (if window resizes, we should alter this to reflect as well)
-    const OIS::MouseState &mouseState = _getSingleton().mouse_->getMouseState();
-    mouseState.width  = width;
-    mouseState.height = height;
+    if (_getSingleton().mouse_)
+    {
+      // Set mouse region (if window resizes, we should alter this to reflect as well)
+      const OIS::MouseState &mouseState = _getSingleton().mouse_->getMouseState();
+      mouseState.width  = width;
+      mouseState.height = height;
+    }
   }
 
@@ -382,14 +612,16 @@
   }
 
-  bool InputManager::initialise(size_t windowHnd, int windowWidth, int windowHeight)
-  {
-    return _getSingleton()._initialise(windowHnd, windowWidth, windowHeight);
+  bool InputManager::initialise(size_t windowHnd, int windowWidth, int windowHeight,
+    bool createKeyboard, bool createMouse, bool createJoySticks)
+  {
+    return _getSingleton()._initialise(windowHnd, windowWidth, windowHeight,
+          createKeyboard, createMouse, createJoySticks);
   }
 
   bool InputManager::addKeyListener(OIS::KeyListener *listener, const std::string& name)
   {
-    if (_getSingleton().keyListeners_.find(name) == _getSingleton().keyListeners_.end())
-    {
-      _getSingleton().keyListeners_[name] = listener;
+    if (_getSingleton().listenersKey_.find(name) == _getSingleton().listenersKey_.end())
+    {
+      _getSingleton().listenersKey_[name] = listener;
       return true;
     }
@@ -400,8 +632,8 @@
   bool InputManager::removeKeyListener(const std::string &name)
   {
-    std::map<std::string, OIS::KeyListener*>::iterator it = _getSingleton().keyListeners_.find(name);
-    if (it != _getSingleton().keyListeners_.end())
-    {
-      _getSingleton().keyListeners_.erase(it);
+    std::map<std::string, OIS::KeyListener*>::iterator it = _getSingleton().listenersKey_.find(name);
+    if (it != _getSingleton().listenersKey_.end())
+    {
+      _getSingleton().listenersKey_.erase(it);
       return true;
     }
@@ -412,6 +644,6 @@
   OIS::KeyListener* InputManager::getKeyListener(const std::string& name)
   {
-    std::map<std::string, OIS::KeyListener*>::iterator it = _getSingleton().keyListeners_.find(name);
-    if (it != _getSingleton().keyListeners_.end())
+    std::map<std::string, OIS::KeyListener*>::iterator it = _getSingleton().listenersKey_.find(name);
+    if (it != _getSingleton().listenersKey_.end())
     {
       return (*it).second;
Index: code/branches/input/src/core/InputManager.h
===================================================================
--- code/branches/input/src/core/InputManager.h	(revision 1182)
+++ code/branches/input/src/core/InputManager.h	(revision 1193)
@@ -56,54 +56,53 @@
           public OIS::MouseListener, public OIS::KeyListener, public OIS::JoyStickListener
   {
-  public:
+  public: // enumerations
     /**
-      @brief Designates the way input is handled currently.
-      IM_GUI:    All the OIS input events are passed to CEGUI
-      IM_BUFFER: Only keyboard input is captured and passed to the InputBuffer
-      IM_NORMAL: Normal game mode. Key bindings and mouse are active.
+      @brief Designates the way input is handled and redirected.
     */
     enum InputState
     {
-      IS_UNINIT,
-      IS_NONE,
-      IS_NORMAL,
-      IS_GUI,
-      IS_CONSOLE,
-      IS_CUSTOM
+      IS_UNINIT,  //!< InputManager has not yet been initialised.
+      IS_NONE,    //!< Input is discarded.
+      IS_NORMAL,  //!< Normal play state. Key and button bindings are active.
+      IS_GUI,     //!< All OIS input events are passed to CEGUI.
+      IS_CONSOLE, //!< Keyboard input is redirected to the InputBuffer.
+      IS_CUSTOM   //!< Any possible configuration.
     };
 
-  public:
-    void tick(float dt);
-
-    static bool initialise(size_t windowHnd, int windowWidth, int windowHeight);
+  public: // functions
+    // METHODS OF THE STATIC INTERFACE
+
+    static bool initialise(size_t windowHnd, int windowWidth, int windowHeight,
+          bool createKeyboard = true, bool createMouse = true, bool createJoySticks = false);
     static void destroy();
 
     static void setWindowExtents(int width, int height);
+
     static void setInputState(const InputState state);
     static InputState getInputState();
+    static void setKeyBindingState           (bool bActive);
+    static void setMouseButtonBindingState   (bool bActive);
+    static void setJoyStickButtonBindingState(bool bActive);
 
     static bool addKeyListener(OIS::KeyListener* listener, const std::string& name);
-    //static bool removeKeyListener(OIS::KeyListener* listener);
-    static bool removeKeyListener(const std::string& name);
-    static bool enableKeyListener(const std::string& name);
-    static bool disableKeyListener(const std::string& name);
+    static bool removeKeyListener  (const std::string& name);
+    static bool enableKeyListener  (const std::string& name);
+    static bool disableKeyListener (const std::string& name);
+    static bool isKeyListenerActive(const std::string& name);
     static OIS::KeyListener* getKeyListener(const std::string& name);
-    static bool isKeyListenerActive(const std::string& name);
 
     static bool addMouseListener(OIS::MouseListener* listener, const std::string& name);
-    //static bool removeMouseListener(OIS::MouseListener* listener);
-    static bool removeMouseListener(const std::string& name);
-    static bool enableMouseListener(const std::string& name);
-    static bool disableMouseListener(const std::string& name);
+    static bool removeMouseListener  (const std::string& name);
+    static bool enableMouseListener  (const std::string& name);
+    static bool disableMouseListener (const std::string& name);
+    static bool isMouseListenerActive(const std::string& name);
     static OIS::MouseListener* getMouseListener(const std::string& name);
-    static bool isMouseListenerActive(const std::string& name);
 
     static bool addJoyStickListener(OIS::JoyStickListener* listener, const std::string& name);
-    //static bool removeJoyStickListener(OIS::JoyStickListener* listener);
-    static bool removeJoyStickListener(const std::string& name);
-    static bool enableJoyStickListener(const std::string& name);
-    static bool disableJoyStickListener(const std::string& name);
+    static bool removeJoyStickListener  (const std::string& name);
+    static bool enableJoyStickListener  (const std::string& name);
+    static bool disableJoyStickListener (const std::string& name);
+    static bool isJoyStickListenerActive(const std::string& name);
     static OIS::JoyStickListener* getJoyStickListener(const std::string& name);
-    static bool isJoyStickListenerActive(const std::string& name);
 
     // Temporary solutions. Will be removed soon!
@@ -111,5 +110,5 @@
     static OIS::Keyboard* getKeyboard() { return _getSingleton().keyboard_; }
 
-  private:
+  private: // functions
     // don't mess with a Singleton
     InputManager ();
@@ -117,8 +116,16 @@
     ~InputManager();
 
-    bool _initialise(size_t windowHnd, int windowWidth, int windowHeight);
+    // Intenal methods
+    bool _initialise(size_t, int, int, bool, bool, bool);
+    void _initialiseKeyboard();
+    void _initialiseMouse();
+    void _initialiseJoySticks();
     void _destroy();
-    void _setDefaultState();
-    void _loadBindings();
+    //void _setDefaultState();
+    bool _loadBindings();
+    void _clearBindings();
+    void _setNumberOfJoysticks(int size);
+
+    void tick(float dt);
 
     // input events
@@ -137,28 +144,32 @@
     static InputManager* _getSingletonPtr() { return &_getSingleton(); }
 
-  private:
+  private: // variables
     OIS::InputManager* inputSystem_;    //!< OIS input manager
     OIS::Keyboard*     keyboard_;       //!< OIS mouse
     OIS::Mouse*        mouse_;          //!< OIS keyboard
+    std::vector<OIS::JoyStick*> joySticks_;       //!< OIS joy sticks
 
     InputState state_;
     InputState stateRequest_;
 
-    std::list<OIS::KeyCode> keysDown_;
-
-    bool bDefaultKeyInput;
-    bool bDefaultMouseInput;
-    bool bDefaultJoyStickInput;
-
-    std::map<std::string, OIS::KeyListener*>      keyListeners_;
-    std::list<OIS::KeyListener*>                  activeKeyListeners_;
-    std::map<std::string, OIS::MouseListener*>    mouseListeners_;
-    std::list<OIS::MouseListener*>                activeMouseListeners_;
-    std::map<std::string, OIS::JoyStickListener*> joystickListeners_;
-    std::list<OIS::JoyStickListener*>             activeJoyStickListeners_;
+    bool bKeyBindingsActive_;
+    bool bMouseButtonBindingsActive_;
+    std::vector<bool> bJoyStickButtonBindingsActive_;
+
+    std::map<std::string, OIS::KeyListener*>      listenersKey_;
+    std::map<std::string, OIS::MouseListener*>    listenersMouse_;
+    std::map<std::string, OIS::JoyStickListener*> listenersJoySticks_;
+
+    std::list<OIS::KeyListener*>      listenersKeyActive_;
+    std::list<OIS::MouseListener*>    listenersMouseActive_;
+    std::list<OIS::JoyStickListener*> listenersJoySticksActive_;
+
+    std::list<OIS::KeyCode>         keysDown_;
+    std::list<OIS::MouseButtonID>   mouseButtonsDown_;
+    std::vector< std::list<int> >   joyStickButtonsDown_;
 
 
     /** denotes the maximum number of different keys there are in OIS.
-        256 should be ok since the highest number in the enum is 237. */
+        256 should be ok since the highest number in the OIS enum is 237. */
     static const int numberOfKeys_s = 256;
     //! Array of input events for every pressed key
@@ -170,5 +181,5 @@
 
     /** denotes the maximum number of different buttons there are in OIS.
-        16 should be ok since the highest number in the enum is 7. */
+        16 should be ok since the highest number in the OIS enum is 7. */
     static const int numberOfMouseButtons_s = 16;
     //! Array of input events for every pressed mouse button
@@ -182,10 +193,7 @@
         32 should be ok. */
     static const int numberOfJoyStickButtons_s = 32;
-    //! Array of input events for every pressed joystick button
-    std::string bindingsJoyStickButtonPress_  [numberOfJoyStickButtons_s];
-    //! Array of input events for every released joystick button
-    std::string bindingsJoyStickButtonRelease_[numberOfJoyStickButtons_s];
-    //! Array of input events for every held joystick button
-    std::string bindingsJoyStickButtonHold_   [numberOfJoyStickButtons_s];
+    std::vector< std::vector< std::string > > bindingsJoyStickButtonPress_;
+    std::vector< std::vector< std::string > > bindingsJoyStickButtonRelease_;
+    std::vector< std::vector< std::string > > bindingsJoyStickButtonHold_;
 
   };
