diff --git a/dev/js/src/hint.js b/dev/js/src/hint.js
index 8859c0a..c5c689c 100644
--- a/dev/js/src/hint.js
+++ b/dev/js/src/hint.js
@@ -5,6 +5,7 @@
  * @author Nils Diewald
  */
 /*
+ * TODO: Check for cnx/syn=
  * TODO: List can be shown when prefix is like 'base/s=pcorenlp/'
  * TODO: Sometimes the drop-down box down vanish when list is shown
  * TODO: Create should expect an input text field
@@ -195,8 +196,9 @@
       // Get context (aka left text)
       var context = this._inputField.context();
 
-      if (context === undefined || context.length === 0)
-	      return ifContext ? undefined : this.menu("-");
+      if (context === undefined || context.length === 0) {
+	      return ifContext ? false : this.menu("-");
+      };
 
       // Get context (aka left text matching regex)
       context = this._analyzer.test(context);
@@ -239,8 +241,7 @@
 
     /**
      * Show the menu.
-     * Currently this means that multiple menus may be loaded
-     * but not shown.
+     * Remove all old menus.
      *
      * @param {boolean} Boolean value to indicate if context
      *        is necessary (true) or if the main context should
@@ -260,7 +261,7 @@
 	      };
 
 	      // This may already be hidden!
-	      this._active.hide();
+	      // this._active.hide();
 	      this.active(null);
 
 	      // Alert is not active
@@ -283,26 +284,40 @@
 	      menu.focus();
 	      // Focus on input field
 	      // this.inputField.element.focus();
+      }
+      else {
+        this._inputField.element().focus();
       };
     },
     
-    // Show an object in the containerField
-    // This will hide all other objects
-    // Accepts menus as well as alerts
-    show2 : function (obj) {
-      var c = this._inputField.container();
-
-    },
-
     // This will get the context of the field
     getContext : function () {},
 
     /**
      * Deactivate the current menu and focus on the input field.
      */
-    unshow : function () {
+    unshow_old : function () {
       this.active(null);
       this.inputField().element().focus();
+    },
+
+    /**
+     * Deactivate the current menu and focus on the input field.
+     */
+    unshow : function () {
+      var c = this._inputField.container();
+
+      if (this.active() !== null) {
+        var act = this.active();
+        
+        // This does not work for alert currently!
+	      if (act._type !== 'alert') {
+	        c.removeChild(this._active.element());
+	      };
+        // this._active.hide();
+        this.active(null);
+      };
+      this._inputField.element().focus();
     }
   };
 });
diff --git a/dev/js/src/hint/item.js b/dev/js/src/hint/item.js
index cfea816..66819c6 100644
--- a/dev/js/src/hint/item.js
+++ b/dev/js/src/hint/item.js
@@ -9,23 +9,23 @@
      */
     create : function (params) {
       return Object.create(itemClass)
-	.upgradeTo(this)
-	._init(params);
+	      .upgradeTo(this)
+	      ._init(params);
     },
 
     // Initialize menu item object
     _init : function (params) {
       if (params[0] === undefined ||
-	  params[1] === undefined)
-	throw new Error("Missing parameters");
+	        params[1] === undefined)
+	      throw new Error("Missing parameters");
       
       this._name   = params[0];
       this._action = params[1];
       this._lcField = ' ' + this._name.toLowerCase();
       
       if (params.length > 2) {
-	this._desc = params[2];
-	this._lcField += " " + this._desc.toLowerCase();
+	      this._desc = params[2];
+	      this._lcField += " " + this._desc.toLowerCase();
       };
 
       return this;
@@ -36,7 +36,7 @@
      */
     content : function (content) {
       if (arguments.length === 1) {
-	this._content = content;
+	      this._content = content;
       };
       return this._content;
     },
@@ -89,13 +89,13 @@
     element : function () {
       // already defined
       if (this._element !== undefined)
-	return this._element;
+	      return this._element;
 
       // Create list item
       var li = document.createElement("li");
 
       if (this.onclick !== undefined) {
-	li["onclick"] = this.onclick.bind(this);
+	      li["onclick"] = this.onclick.bind(this);
       };
 
       // Create title
@@ -106,10 +106,10 @@
 
       // Create description
       if (this._desc !== undefined) {
-	var desc = document.createElement("span");
-	desc.classList.add('desc');
-	desc.appendChild(document.createTextNode(this._desc));
-	li.appendChild(desc);
+	      var desc = document.createElement("span");
+	      desc.classList.add('desc');
+	      desc.appendChild(document.createTextNode(this._desc));
+	      li.appendChild(desc);
       };
       return this._element = li;
     }
