Index: /trunk/src/lib/lang/class_list.cc
===================================================================
--- /trunk/src/lib/lang/class_list.cc	(revision 7402)
+++ /trunk/src/lib/lang/class_list.cc	(revision 7403)
@@ -249,5 +249,5 @@
     if (cl != NULL)
     {
-      std::list<BaseObject*>::const_iterator bo = find (cl->objectList.begin(), cl->objectList.end(), object);
+      std::list<BaseObject*>::const_iterator bo = std::find (cl->objectList.begin(), cl->objectList.end(), object);
       return (bo != cl->objectList.end());
     }
@@ -258,5 +258,5 @@
     for (cl = ClassList::classList->begin(); cl != ClassList::classList->end(); cl++)
     {
-      std::list<BaseObject*>::const_iterator bo = find ((*cl).objectList.begin(), (*cl).objectList.end(), object);
+      std::list<BaseObject*>::const_iterator bo = std::find ((*cl).objectList.begin(), (*cl).objectList.end(), object);
       if (bo != (*cl).objectList.end())
         return true;
@@ -265,4 +265,18 @@
   return false;
 }
+
+bool ClassList::exists(const std::string& className, const std::string& objectName)
+{
+  ClassList* cl = ClassList::getClassList(className);
+  if (likely(cl != NULL))
+  {
+    std::list<BaseObject*>::iterator bo;
+    for (bo = cl->objectList.begin(); bo != cl->objectList.end(); bo++)
+      if ((*bo)->getName() != NULL && objectName == (*bo)->getName())
+        return true;
+  }
+  return false;
+}
+
 
 /**
Index: /trunk/src/lib/lang/class_list.h
===================================================================
--- /trunk/src/lib/lang/class_list.h	(revision 7402)
+++ /trunk/src/lib/lang/class_list.h	(revision 7403)
@@ -47,4 +47,5 @@
     static BaseObject*                    getObject(const std::string& name, ClassID classID = CL_NULL);
     static bool                           exists(const BaseObject* object, ClassID classID = CL_NULL);
+    static bool                           exists(const std::string& className, const std::string& objectName);
 
     void                                  sendBack(std::list<BaseObject*>::const_iterator it);
Index: /trunk/src/lib/shell/shell_command.cc
===================================================================
--- /trunk/src/lib/shell/shell_command.cc	(revision 7402)
+++ /trunk/src/lib/shell/shell_command.cc	(revision 7403)
@@ -70,5 +70,5 @@
   ShellCommand* ShellCommand::registerCommand(const std::string& commandName, const std::string& className, const Executor& executor)
   {
-    if (ShellCommand::isRegistered(commandName, className))
+    if (ShellCommand::exists(commandName, className))
       return NULL;
     else
@@ -104,8 +104,8 @@
    * This is checked in the registerCommand-function.
    */
-  bool ShellCommand::isRegistered(const std::string& commandName, const std::string& className)
-  {
-    const ShellCommandClass* checkClass = ShellCommandClass::isRegistered(className);
-    if (checkClass != NULL)
+  bool ShellCommand::exists(const std::string& commandName, const std::string& className)
+  {
+    const ShellCommandClass* checkClass = ShellCommandClass::exists(className);
+    if (likely(checkClass != NULL))
     {
       std::vector<ShellCommand*>::const_iterator elem;
@@ -139,4 +139,5 @@
     bool emptyComplete = false;                  //< if the completion input is empty string. e.g ""
     //  long completeType = SHELLC_NONE;           //< the Type we'd like to complete.
+
     SubString inputSplits(executionString, SubString::WhiteSpacesWithComma);
 
@@ -147,75 +148,73 @@
 
     // if we only have one input (!MUST BE AN ALIAS)
-    if (inputSplits.size() >= 1)
-    {
-      // CHECK FOR ALIAS
-      std::vector<ShellCommandAlias*>::const_iterator alias;
-      for (alias = ShellCommandAlias::getAliases().begin(); alias != ShellCommandAlias::getAliases().end(); alias++ )
-      {
-        if (inputSplits.getString(0) == (*alias)->getName() && (*alias)->getCommand() != NULL &&
-            (*alias)->getCommand()->shellClass != NULL )
+    // CHECK FOR ALIAS
+    std::vector<ShellCommandAlias*>::const_iterator alias;
+    for (alias = ShellCommandAlias::getAliases().begin(); alias != ShellCommandAlias::getAliases().end(); alias++ )
+    {
+      if (inputSplits.getString(0) == (*alias)->getName() && (*alias)->getCommand() != NULL &&
+          (*alias)->getCommand()->shellClass != NULL )
+      {
+        objectList = ClassList::getList((*alias)->getCommand()->shellClass->getName());
+        if (objectList != NULL)
         {
-          objectList = ClassList::getList((*alias)->getCommand()->shellClass->getName());
-          if (objectList != NULL)
+          (*(*alias)->getCommand()->executor)(objectList->front(), inputSplits.getSubSet(1).join());
+          return true;
+        }
+      }
+    }
+
+    // looking for a Matching Class (in the First Argument)
+    std::vector<ShellCommandClass*>::iterator commandClassIT;
+    for (commandClassIT = ShellCommandClass::commandClassList.begin(); commandClassIT != ShellCommandClass::commandClassList.end(); commandClassIT++)
+    {
+      if (inputSplits[0] == (*commandClassIT)->getName())
+      {
+        //elemCL->getName();
+        classID = ClassList::StringToID((*commandClassIT)->getName());
+        commandClass = (*commandClassIT);
+        objectList = ClassList::getList((ClassID)classID);
+        break;
+      }
+    }
+
+    // Second Agument. (either Object, or Function)
+    if (commandClass != NULL && inputSplits.size() >= 2)
+    {
+      int fktPos = 1; // The position of the Function (either at pos 1(if object given), or 2)
+      // If we have an ObjectList.
+      if (objectList != NULL)
+      {
+        // Checking for a Match in the Objects of classID (else take the first)
+        std::list<BaseObject*>::const_iterator object;
+        for (object = objectList->begin(); object != objectList->end(); object++)
+        {
+          if ((*object)->getName() != NULL && inputSplits[1] == (*object)->getName())
           {
-            (*(*alias)->getCommand()->executor)(objectList->front(), inputSplits.getSubSet(1).join());
-            return true;
+            /// TODO make this work for multiple Objects at once.
+            objectPointer = (*object);
+            fktPos = 2;
+            break;
           }
         }
-      }
-
-      // looking for a Matching Class
-      std::vector<ShellCommandClass*>::iterator commandClassIT;
-      for (commandClassIT = ShellCommandClass::commandClassList.begin(); commandClassIT != ShellCommandClass::commandClassList.end(); commandClassIT++)
-      {
-        if ((*commandClassIT)->getName() && inputSplits[0] == (*commandClassIT)->getName())
+
+        // if we did not find an Object with matching name, take the first.
+        if (objectPointer == NULL)
+          objectPointer = objectList->front();
+      }
+
+      // match a function.
+      if (commandClass != NULL && (fktPos == 1 || (fktPos == 2 && inputSplits.size() >= 3)))
+      {
+        std::vector<ShellCommand*>::iterator cmdIT;
+        for (cmdIT = commandClass->commandList.begin(); cmdIT != commandClass->commandList.end(); cmdIT++)
         {
-          //elemCL->getName();
-          classID = ClassList::StringToID((*commandClassIT)->getName());
-          commandClass = (*commandClassIT);
-          objectList = ClassList::getList((ClassID)classID);
-          break;
-        }
-      }
-
-      // Second Agument. (either Object, or Function)
-      if (commandClass != NULL && inputSplits.size() >= 2)
-      {
-        int fktPos = 1; // The position of the Function (either at pos 1, or 2)
-        // If we have an ObjectList.
-        if (objectList != NULL)
-        {
-          // Checking for a Match in the Objects of classID (else take the first)
-          std::list<BaseObject*>::const_iterator object;
-          for (object = objectList->begin(); object != objectList->end(); object++)
+          if (inputSplits[fktPos] == (*cmdIT)->getName())
           {
-            if ((*object)->getName() != NULL && inputSplits[1] == (*object)->getName())
+            if (objectPointer == NULL && (*cmdIT)->executor->getType() & Executor_Objective)
+              return false;
+            else
             {
-              objectPointer = (*object);
-              fktPos = 2;
-              break;
-            }
-          }
-
-          // if we did not find an Object with matching name, take the first.
-          if (objectPointer == NULL)
-            objectPointer = objectList->front();
-        }
-
-        // match a function.
-        if (commandClass != NULL && (fktPos == 1 || (fktPos == 2 && inputSplits.size() >= 3)))
-        {
-          std::vector<ShellCommand*>::iterator cmdIT;
-          for (cmdIT = commandClass->commandList.begin(); cmdIT != commandClass->commandList.end(); cmdIT++)
-          {
-            if (inputSplits[fktPos] == (*cmdIT)->getName())
-            {
-              if (objectPointer == NULL && (*cmdIT)->executor->getType() & Executor_Objective)
-                return false;
-              else
-              {
-                (*(*cmdIT)->executor)(objectPointer, inputSplits.getSubSet(fktPos+1).join()); /// TODO CHECK IF OK
-                return true;
-              }
+              (*(*cmdIT)->executor)(objectPointer, inputSplits.getSubSet(fktPos+1).join()); /// TODO CHECK IF OK
+              return true;
             }
           }
@@ -234,9 +233,6 @@
     if (this == NULL)
       return NULL;
-    else
-    {
-      this->description = description;
-      return this;
-    }
+    this->description = description;
+    return this;
   }
 
@@ -344,4 +340,5 @@
   * @returns true on success, false otherwise
    */
+
   bool ShellCommandAlias::getCommandListOfAlias(std::list<std::string>& stringList)
   {
Index: /trunk/src/lib/shell/shell_command.h
===================================================================
--- /trunk/src/lib/shell/shell_command.h	(revision 7402)
+++ /trunk/src/lib/shell/shell_command.h	(revision 7403)
@@ -72,6 +72,6 @@
 
     static ShellCommand* registerCommand(const std::string& commandName, const std::string& className, const Executor& executor);
-
     static void unregisterCommand(const std::string& commandName, const std::string& className);
+    static bool exists(const std::string& commandName, const std::string& className);
 
     static void debug();
@@ -81,5 +81,4 @@
     virtual ~ShellCommand();
 
-    static bool isRegistered(const std::string& commandName, const std::string& className);
     static const std::string& paramToString(long parameter);
 
Index: /trunk/src/lib/shell/shell_command_class.cc
===================================================================
--- /trunk/src/lib/shell/shell_command_class.cc	(revision 7402)
+++ /trunk/src/lib/shell/shell_command_class.cc	(revision 7403)
@@ -110,5 +110,5 @@
    * @returns the CommandClass if found, NULL otherwise
    */
-  const ShellCommandClass* ShellCommandClass::isRegistered(const std::string& className)
+  const ShellCommandClass* ShellCommandClass::exists(const std::string& className)
   {
     std::vector<ShellCommandClass*>::const_iterator classIT;
Index: /trunk/src/lib/shell/shell_command_class.h
===================================================================
--- /trunk/src/lib/shell/shell_command_class.h	(revision 7402)
+++ /trunk/src/lib/shell/shell_command_class.h	(revision 7403)
@@ -30,4 +30,5 @@
     static ShellCommandClass* getCommandClass(const std::string& className);
     static void unregisterAllCommands();
+    static const ShellCommandClass* exists(const std::string& className);
 
     static void help (const std::string& className);
@@ -37,5 +38,4 @@
     virtual ~ShellCommandClass();
 
-    static const ShellCommandClass* isRegistered(const std::string& className);
 
     void registerCommand(ShellCommand* command);
Index: /trunk/src/lib/shell/shell_completion.cc
===================================================================
--- /trunk/src/lib/shell/shell_completion.cc	(revision 7402)
+++ /trunk/src/lib/shell/shell_completion.cc	(revision 7403)
@@ -51,9 +51,9 @@
   bool ShellCompletion::autoComplete(std::string& input)
   {
-    long classID;                               //< the classID retrieved from the Class.
-    const std::list<BaseObject*>* objectList;   //< the list of Objects stored in classID
+    long classID = CL_NULL;                     //< the classID retrieved from the Class.
+    const std::list<BaseObject*>* objectList;   //< the list of Objects stored in classID's ClassList
     bool emptyComplete = false;                 //< if the completion input is empty string. e.g ""
     long completeType = NullCompletion;         //< the Type we'd like to complete.
-    std::string completeString;                 //< the string to complete.
+    std::string completeString = "";            //< the string to complete.
 
 
@@ -62,5 +62,5 @@
 
     // Check if we are in a input. eg. the supplied string "class " and now we complete either function or object
-    if (input[input.size()-1] == ' ')
+    if (input.empty() || input[input.size()-1] == ' ')
       emptyComplete = true;
 
@@ -69,24 +69,17 @@
 
     // What String will be completed
-    if (emptyComplete == true)
-      completeString = "";
-    else
+    if (!emptyComplete && inputSplits.size() >= 1)
       completeString = inputSplits.getString(inputSplits.size()-1);
 
-    // CLASS COMPLETION
-    if (inputSplits.size() == 0)
+    // CLASS/ALIAS COMPLETION (on first argument)
+    if (inputSplits.size() == 0 || (!emptyComplete && inputSplits.size() == 1))
     {
       completeType |= ClassCompletion;
       completeType |= AliasCompletion;
     }
-    else if (inputSplits.size() == 1 && emptyComplete == false)
-    {
-      completeType |= ClassCompletion;
-      completeType |= AliasCompletion;
-    }
 
     // OBJECT/FUNCTION COMPLETIONS
-    else if ((inputSplits.size() == 1 && emptyComplete == true) ||
-             (inputSplits.size() == 2 && emptyComplete == false))
+    else if ((emptyComplete && inputSplits.size() == 1) ||
+              (!emptyComplete && inputSplits.size() == 2))
     {
       classID = ClassList::StringToID(inputSplits.getString(0));
@@ -94,14 +87,10 @@
       if (classID != CL_NULL)
         completeType |= ObjectCompletion;
-      //if (objectList != NULL && objectList->getSize() == 1)
       completeType |= FunctionCompletion;
     }
-    else if ((inputSplits.size() == 2 && emptyComplete == true) ||
-             (inputSplits.size() == 3 && emptyComplete == false))
-    {
-      classID = ClassList::StringToID(inputSplits.getString(0));
-      if (classID == CL_NULL)
-        return false;
-      else
+    else if ((emptyComplete && inputSplits.size() == 2 ) ||
+             (!emptyComplete && inputSplits.size() == 3))
+    {
+      if (ClassList::exists(inputSplits[0], inputSplits[1]))
         completeType |= FunctionCompletion;
     }
Index: /trunk/src/lib/shell/shell_completion.h
===================================================================
--- /trunk/src/lib/shell/shell_completion.h	(revision 7402)
+++ /trunk/src/lib/shell/shell_completion.h	(revision 7403)
@@ -22,52 +22,54 @@
   class ShellCompletion
   {
-    //! an enumerator for different types the Shell can complete.
-    typedef enum {
-      NullCompletion         = 0,
-      ClassCompletion        = 1,
-      ObjectCompletion       = 2,
-      FunctionCompletion     = 4,
-      AliasCompletion        = 8,
+      //! an enumerator for different types the Shell can complete.
+      typedef enum {
+        NullCompletion         = 0,
+        ClassCompletion        = 1,
+        ObjectCompletion       = 2,
+        FunctionCompletion     = 4,
+        AliasCompletion        = 8,
     } CompletionType;
 
-    //! A struct for ShellElements (these are used as containers to identify an Input for what it is)
-    struct CompletionElement
-    {
-      std::string     name;     //!< the Name of the Element to be completed.
-      CompletionType  type;     //!< the type of the Element
-    };
+      //! A struct for ShellElements (these are used as containers to identify an Input for what it is)
+      struct CompletionElement
+      {
+        std::string     name;     //!< the Name of the Element to be completed.
+        CompletionType  type;     //!< the type of the Element
+      };
 
-  public:
-    ShellCompletion();
-    virtual ~ShellCompletion();
+    public:
+      ShellCompletion();
+      virtual ~ShellCompletion();
 
 
-    // Functions to produce the Complete Lists.
-    bool autoComplete(std::string& input);
-    //  long classMatch(const char* input, unsigned int* length);
-    bool objectComplete(const std::string& objectBegin, long classID);
-    //  bool objectMatch(const char* objectBegin, long classID, unsigned int* length);
-    bool commandComplete(const std::string& commandBegin, const std::string& className);
-    //  bool functionMatch(const char* functionBegin, long classID, unsigned int* length);
-    bool aliasComplete(const std::string& aliasBegin);
+      // Functions to produce the Complete Lists.
+      bool autoComplete(std::string& input);
 
-    // Generally Completes.
-    bool generalComplete(std::string& input,
-                         const std::string& begin, const std::string& displayAs = "%s",
-                         const std::string& addBack = "", const std::string& addFront = "");
+      static const std::string& ShellCompletion::typeToString(ShellCompletion::CompletionType type);
+
+    private:
+      //  long classMatch(const char* input, unsigned int* length);
+      bool objectComplete(const std::string& objectBegin, long classID);
+      //  bool objectMatch(const char* objectBegin, long classID, unsigned int* length);
+      bool commandComplete(const std::string& commandBegin, const std::string& className);
+      //  bool functionMatch(const char* functionBegin, long classID, unsigned int* length);
+      bool aliasComplete(const std::string& aliasBegin);
+
+      // Generally Completes.
+      bool generalComplete(std::string& input,
+                           const std::string& begin, const std::string& displayAs = "%s",
+                           const std::string& addBack = "", const std::string& addFront = "");
 
 
-    bool addToCompleteList(const std::list<std::string>& inputList, const std::string& completionBegin, ShellCompletion::CompletionType type);
-    bool addToCompleteList(const std::list<BaseObject*>& inputList, const std::string& completionBegin, ShellCompletion::CompletionType type);
+      bool addToCompleteList(const std::list<std::string>& inputList, const std::string& completionBegin, ShellCompletion::CompletionType type);
+      bool addToCompleteList(const std::list<BaseObject*>& inputList, const std::string& completionBegin, ShellCompletion::CompletionType type);
 
+      // Helpers.
+      void clearCompletionList();
 
-    // Helpers.
-    void clearCompletionList();
-    static const std::string& ShellCompletion::typeToString(ShellCompletion::CompletionType type);
+    private:
+      std::vector<CompletionElement>  completionList;          //!< A list of completions, that are io.
 
-  private:
-    std::vector<CompletionElement>  completionList;          //!< A list of completions, that are io.
-
-    static const std::string        typeNames[];             //!< A list of Completion-Type-Names.
+      static const std::string        typeNames[];             //!< A list of Completion-Type-Names.
   };
 
Index: /trunk/src/lib/shell/shell_input.h
===================================================================
--- /trunk/src/lib/shell/shell_input.h	(revision 7402)
+++ /trunk/src/lib/shell/shell_input.h	(revision 7403)
@@ -39,9 +39,10 @@
 
     // InputLine
-    void flush();
     void setInputText(const std::string& text);
     void addCharacter(char character);
     void addCharacters(const std::string& characters);
     void removeCharacters(unsigned int characterCount = 1);
+    void flush();
+
     void setRepeatDelay(float repeatDelay, float repeatRate);
 
