Index: code/branches/presentation2/src/libraries/core/input/KeyBinder.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/input/KeyBinder.cc	(revision 6303)
+++ code/branches/presentation2/src/libraries/core/input/KeyBinder.cc	(revision 6311)
@@ -29,4 +29,6 @@
 #include "KeyBinder.h"
 
+#include <algorithm>
+#include <sstream>
 #include "util/Convert.h"
 #include "util/Debug.h"
@@ -256,5 +258,5 @@
         {
             it->second->readConfigValue(this->configFile_);
-            this->allCommands_[it->second->bindingString_] = it->second->groupName_ + " " + it->second->name_;
+            addButtonToCommand(it->second->bindingString_, it->second);
         }
 
@@ -267,4 +269,5 @@
         if (it != allButtons_.end())
         {
+            addButtonToCommand(binding, it->second);
             if (bTemporary)
                 it->second->configContainer_->tset(binding);
@@ -272,5 +275,4 @@
                 it->second->configContainer_->set(binding);
             it->second->configContainer_->getValue(&(it->second->bindingString_), it->second);
-            this->allCommands_[it->second->bindingString_] = it->second->groupName_ + " " + it->second->name_;
             return true;
         }
@@ -282,21 +284,80 @@
     }
     
-    /**
-    @brief
-        Return the key name for a specific command
+     void KeyBinder::addButtonToCommand(std::string command, Button* button)
+     {  
+        std::ostringstream stream;
+        stream << button->groupName_  << "." << button->name_;
+        
+        std::vector<std::string>& oldKeynames = this->allCommands_[button->bindingString_];
+        std::vector<std::string>::iterator it = std::find(oldKeynames.begin(), oldKeynames.end(), stream.str());
+        if(it != oldKeynames.end())
+        {
+            oldKeynames.erase(it);
+        }
+        
+        if(command != "")
+        {
+            std::vector<std::string>& keynames = this->allCommands_[command];
+            if( std::find(keynames.begin(), keynames.end(), stream.str()) == keynames.end())
+            {
+                this->allCommands_[command].push_back(stream.str());
+            }
+        }
+     }
+    
+    /**
+    @brief
+        Return the first key name for a specific command
     */
     std::string KeyBinder::getBinding(std::string commandName)
     {
-        COUT(0)<< commandName << endl;
         if( this->allCommands_.find(commandName) != this->allCommands_.end())
         {
-            std::string keyname = this->allCommands_[commandName];
-//             while(keyname.find(".")!=keyname.npos)
-//                 keyname.replace(1, keyname.find("."), " ");
-            COUT(0) << keyname << endl;
-            return keyname;
-        }
-        else
+            std::vector<std::string>& keynames = this->allCommands_[commandName];
+            return keynames.front();
+        }
+        
+        return "";
+    }
+    
+    /**
+    @brief
+        Return the key name for a specific command at a given index.
+    @param commandName
+        The command name the key name is returned for.
+    @param index
+        The index at which the key name is returned for.
+    */
+    std::string KeyBinder::getBinding(std::string commandName, unsigned int index)
+    {
+        if( this->allCommands_.find(commandName) != this->allCommands_.end())
+        {
+            std::vector<std::string>& keynames = this->allCommands_[commandName];
+            if(index < keynames.size())
+            {
+                return keynames[index];
+            }
+                
             return "";
+        }
+        
+        return "";
+    }
+    
+    /**
+    @brief
+        Get the number of different key bindings of a specific command.
+    @param commandName
+        The command.
+    */
+    unsigned int KeyBinder::getNumberOfBindings(std::string commandName)
+    {
+        if( this->allCommands_.find(commandName) != this->allCommands_.end())
+        {
+            std::vector<std::string>& keynames = this->allCommands_[commandName];
+            return keynames.size();
+        }
+        
+        return 0;
     }
 
Index: code/branches/presentation2/src/libraries/core/input/KeyBinder.h
===================================================================
--- code/branches/presentation2/src/libraries/core/input/KeyBinder.h	(revision 6303)
+++ code/branches/presentation2/src/libraries/core/input/KeyBinder.h	(revision 6311)
@@ -35,4 +35,5 @@
 #include <string>
 #include <vector>
+#include <map>
 #include <boost/shared_ptr.hpp>
 
@@ -66,4 +67,7 @@
         bool setBinding(const std::string& binding, const std::string& name, bool bTemporary = false);
         std::string getBinding(std::string commandName); //tolua_export
+        std::string getBinding(std::string commandName, unsigned int index); //tolua_export
+        unsigned int getNumberOfBindings(std::string commandName); //tolua_export
+        
         const std::string& getBindingsFilename()
             { return this->filename_; }
@@ -135,5 +139,5 @@
         std::vector<HalfAxis*> allHalfAxes_;
         //! Maps input commands to all Button names, including half axes
-        std::map<std::string, std::string> allCommands_;
+        std::map< std::string, std::vector<std::string> > allCommands_;
 
         /**
@@ -156,4 +160,6 @@
 
     private:
+        void addButtonToCommand(std::string command, Button* button);
+        
         //##### ConfigValues #####
         //! Whether to filter small value analog input
Index: code/branches/presentation2/src/libraries/core/input/KeyBinderManager.cc
===================================================================
--- code/branches/presentation2/src/libraries/core/input/KeyBinderManager.cc	(revision 6303)
+++ code/branches/presentation2/src/libraries/core/input/KeyBinderManager.cc	(revision 6311)
@@ -57,4 +57,8 @@
         CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&KeyBinderManager::tkeybind, this), "tkeybind"))
             .defaultValues("");
+        CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&KeyBinderManager::unbind, this), "unbind"))
+            .defaultValues("");
+        CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&KeyBinderManager::tunbind, this), "tunbind"))
+            .defaultValues("");
 
         // Load default key binder
@@ -89,4 +93,14 @@
         else
             this->bDefaultFileLoaded_ = false;
+    }
+    
+    inline void KeyBinderManager::unbind(const std::string& binding)
+    {
+        this->currentBinder_->setBinding("", binding, false);
+    }
+            
+    inline void KeyBinderManager::tunbind(const std::string& binding)
+    {
+        this->currentBinder_->setBinding("", binding, true);
     }
     
@@ -163,6 +177,13 @@
         if (this->bBinding_)
         {
-            COUT(0) << "Binding string \"" << command_ << "\" on key '" << keyName << "'" << std::endl;
-            this->currentBinder_->setBinding(command_, keyName, bTemporary_);
+            if (keyName == "Keys.KeyEscape")
+            {
+                COUT(0) << "Keybinding aborted." << std::endl;
+            }
+            else
+            {
+                COUT(0) << "Binding string \"" << command_ << "\" on key '" << keyName << "'" << std::endl;
+                this->currentBinder_->setBinding(command_, keyName, bTemporary_);
+            }
             InputManager::getInstance().leaveState("detector");
             // inform whatever was calling the command
Index: code/branches/presentation2/src/libraries/core/input/KeyBinderManager.h
===================================================================
--- code/branches/presentation2/src/libraries/core/input/KeyBinderManager.h	(revision 6303)
+++ code/branches/presentation2/src/libraries/core/input/KeyBinderManager.h	(revision 6311)
@@ -100,4 +100,6 @@
         inline void tkeybind(const std::string& command)
             { this->keybindInternal(command, true); }
+        void unbind(const std::string& binding); //tolua_export
+        void tunbind(const std::string& binding);
         inline void registerKeybindCallback(Functor* function) { this->callbackFunction_.reset(function); } // tolua_export
 
