diff --git a/Changes b/Changes
index c615780..ed003ad 100755
--- a/Changes
+++ b/Changes
@@ -1,10 +1,9 @@
-0.20 2016-05-24
+0.20 2016-05-25
 	- Improved menu using sliders.
 	- Improved menu to make prefixes chooseable,
 	  even if list can't be filtered.
-	- Fixed choosable prefixes in hint menu.
 	- Improve pageup/pagedown behaviour in menus.
-	- Fix prefix o support case sensitivity in menus.
+	- Fixed multiple bugs in menu.
 
 0.19 2016-04-28
         - Improved datepicker to enter date strings.
diff --git a/dev/js/spec/menuSpec.js b/dev/js/spec/menuSpec.js
index 55ee44b..f993d33 100644
--- a/dev/js/spec/menuSpec.js
+++ b/dev/js/spec/menuSpec.js
@@ -535,6 +535,15 @@
       expect(menu.element().childNodes[6]).toBe(undefined);
     });
 
+    it('should be nextable without active field', function () {
+      var menu = KorAP.HintMenu.create("cnx/", list);
+      menu.limit(3);
+      expect(menu.show()).toBe(true);
+      menu.next();
+      expect(menu.shownItem(0).active()).toEqual(true);
+    });
+
+
     it('should be prevable', function () {
       var menu = KorAP.HintMenu.create("cnx/", list);
       menu._firstActive = true;
@@ -623,6 +632,14 @@
       expect(menu.element().childNodes[6]).toBe(undefined);
     });
 
+    it('should be prevable without active field', function () {
+      var menu = KorAP.HintMenu.create("cnx/", list);
+      menu.limit(3);
+      expect(menu.show()).toBe(true);
+      menu.prev();
+      expect(menu.shownItem(2).active()).toEqual(true);
+      expect(menu.shownItem(2).lcField()).toEqual(' syntax');
+    });
 
     it('should be navigatable and filterable (prefix = "o")', function () {
       var menu = KorAP.HintMenu.create("cnx/", list);
diff --git a/dev/js/src/menu.js b/dev/js/src/menu.js
index b2c541e..2cd99d6 100644
--- a/dev/js/src/menu.js
+++ b/dev/js/src/menu.js
@@ -6,7 +6,7 @@
 /*
  * TODO: space is not a valid prefix!
  * TODO: Show the slider briefly on move (whenever screen is called).
- * TODO: Optimize scrolling to active item.
+ * TODO: Ignore alt+ and strg+ key strokes.
  */
 define([
   'menu/item',
@@ -75,46 +75,45 @@
       this._slider = sliderClass.create(this);
 
       // Create the element
-      var e = document.createElement("ul");
-      e.style.opacity = 0;
-      e.style.outline = 0;
-      e.setAttribute('tabindex', 0);
-      e.classList.add('menu');
-      e.classList.add('roll');
-      e.appendChild(this._prefix.element());
-      e.appendChild(this._lengthField.element());
-      e.appendChild(this._slider.element());
+      var el = document.createElement("ul");
+      with (el) {
+	style.opacity = 0;
+	style.outline = 0;
+	setAttribute('tabindex', 0);
+	classList.add('menu', 'roll');
+	appendChild(this._prefix.element());
+	appendChild(this._lengthField.element());
+	appendChild(this._slider.element());
+      };
 
       // This has to be cleaned up later on
-      e["menu"] = this;
+      el["menu"] = this;
 
       // Arrow keys
-      e.addEventListener(
+      el.addEventListener(
 	'keydown',
 	this._keydown.bind(this),
 	false
       );
 
       // Strings
-      e.addEventListener(
+      el.addEventListener(
 	'keypress',
 	this._keypress.bind(this),
 	false
       );
 
       // Mousewheel
-      e.addEventListener(
+      el.addEventListener(
 	'wheel',
 	this._mousewheel.bind(this),
 	false
       );
+      this._element = el;
 
-      this._element = e;
-      this.active = false;
-      // this.selected = undefined;
       this._items = new Array();
-      var i = 0;
 
+      var i = 0;
       // Initialize item list based on parameters
       for (i in params) {
 	var obj = this._itemClass.create(params[i]);
@@ -125,12 +124,14 @@
 	this._items.push(obj);
       };
 
-      this._limit    = menuLimit;
-      this._slider.length(this.liveLength());
-      this._slider.limit(this._limit);
+      this._limit = menuLimit;
+      this._slider.length(this.liveLength())
+	.limit(this._limit)
+	.reInit();
 
       this._firstActive = false; // Show the first item active always?
-      this._reset();
+      this.offset = 0;
+      this.position = 0;
       return this;
     },
 
@@ -147,7 +148,7 @@
       };
 
       // Offset is initially zero
-      this._offset = 0;
+      this.offset = 0;
 
       // There is no prefix set
       if (this.prefix().length <= 0) {
@@ -159,7 +160,7 @@
 	  this._items[i].lowlight();
 	};
 
-	this._slider.length(i);
+	this._slider.length(i).reInit();;
 
 	return true;
       };
@@ -188,7 +189,7 @@
 	};
       };
 
-      this._slider.length(this._list.length);
+      this._slider.length(this._list.length).reInit();
 
       // Filter was successful - yeah!
       return this._list.length > 0 ? true : false;
@@ -320,7 +321,7 @@
 	nr = (this.liveLength() - this.limit());
       };
 
-      if (this._offset === nr)
+      if (this.offset === nr)
 	return;
 
       this._showItems(nr);
@@ -348,7 +349,7 @@
       if (arguments.length === 1) {
 	if (this._limit !== limit) {
 	  this._limit = limit;
-	  this._slider.limit(limit);
+	  this._slider.limit(limit).reInit();
 	};
 	return this;
       };
@@ -428,7 +429,7 @@
 	this.position = -1;
       };
 
-      this._offset = offset;
+      this.offset = offset;
       this._showItems(offset); // Show new item list
 
       // Make chosen value active
@@ -452,8 +453,6 @@
      * Hide the menu and call the onHide callback.
      */
     hide : function () {
-      this.active = false;
-      this._unmark();
       this.removeItems();
       this._element.style.opacity = 0;
       this._prefix.clear();
@@ -545,12 +544,12 @@
     shownItem : function (index) {
       if (index >= this.limit())
 	return;
-      return this.liveItem(this._offset + index);
+      return this.liveItem(this.offset + index);
     },
 
 
     /**
-     * Get the length of the full list
+     * Get the length of the full item list
      */
     length : function () {
       return this._items.length;
@@ -572,24 +571,18 @@
      */
     next : function () {
 
-      // No active element set
-      var newItem;
-
-      if (this.position !== -1) {
-	// Set new live item
-	if (!this._prefix.active()) {
-	  var oldItem = this.liveItem(this.position);
-	  oldItem.active(false);
-	};
-      };
-
       // No list
       if (this.liveLength() === 0)
 	return;
 
-      this.position++;
+      // Deactivate old item
+      if (this.position !== -1 && !this._prefix.active()) {
+	this.liveItem(this.position).active(false);
+      };
 
-      newItem = this.liveItem(this.position);
+      // Get new active item
+      this.position++;
+      var newItem = this.liveItem(this.position);
 
       // The next element is undefined - roll to top or to prefix
       if (newItem === undefined) {
@@ -597,26 +590,29 @@
 	// Activate prefix
 	var prefix = this._prefix;
 
-	// Mark prefix
+	// Prefix is set and not active - choose!
 	if (prefix.isSet() && !prefix.active()) {
 	  this.position--;
 	  prefix.active(true);
 	  return;
 	}
+
+	// Choose first item
 	else {
-	  this.position = 0;
 	  newItem = this.liveItem(0);
+	  // choose first item
+	  this.position = 0;
 	  this._showItems(0);
 	};
       }
 
       // The next element is after the viewport - roll down
-      else if (this.position >= (this.limit() + this._offset)) {
+      else if (this.position >= (this.limit() + this.offset)) {
 	this.screen(this.position - this.limit() + 1);
       }
 
       // The next element is before the viewport - roll up
-      else if (this.position <= this._offset) {
+      else if (this.position <= this.offset) {
 	this.screen(this.position);
       };
 
@@ -629,25 +625,26 @@
      */
     prev : function () {
 
-      // No active element set
-      if (this.position === -1) {
-	// TODO: Choose last item
-	return;
-      };
-
       // No list
       if (this.liveLength() === 0)
 	return;
 
-      var newItem;
-
-      // Set new live item
+      // Deactivate old item
       if (!this._prefix.active()) {
-	var oldItem = this.liveItem(this.position--);
-	oldItem.active(false);
+
+	// No active element set
+	if (this.position === -1) {
+	  this.position = this.liveLength();
+	}
+
+	// No active element set
+	else {
+	  this.liveItem(this.position--).active(false);
+	};
       };
 
-      newItem = this.liveItem(this.position);
+      // Get new active item
+      var newItem = this.liveItem(this.position);
 
       // The previous element is undefined - roll to bottom
       if (newItem === undefined) {
@@ -655,34 +652,35 @@
 	// Activate prefix
 	var prefix = this._prefix;
 	var offset =  this.liveLength() - this.limit();
-	// this._offset = this.liveLength() - this.limit();
 
 	// Normalize offset
-	// this._offset = this._offset < 0 ? 0 : this._offset;
 	offset = offset < 0 ? 0 : offset;
 
+	// Choose the last item
 	this.position = this.liveLength() - 1;
 
+	// Prefix is set and not active - choose!
 	if (prefix.isSet() && !prefix.active()) {
 	  this.position++;
 	  prefix.active(true);
-	  this._offset = offset;
+	  this.offset = offset;
 	  return;
 	}
+
+	// Choose last item
 	else {
 	  newItem = this.liveItem(this.position);
-	  this._unmark();
 	  this._showItems(offset);
 	};
       }
 
       // The previous element is before the view - roll up
-      else if (this.position < this._offset) {
+      else if (this.position < this.offset) {
 	this.screen(this.position);
       }
 
       // The previous element is after the view - roll down
-      else if (this.position >= (this.limit() + this._offset)) {
+      else if (this.position >= (this.limit() + this.offset)) {
 	this.screen(this.position - this.limit() + 2);
       };
 
@@ -694,7 +692,7 @@
      * Move the page up by limit!
      */
     pageUp : function () {
-      this.screen(this._offset - this.limit());
+      this.screen(this.offset - this.limit());
     },
 
 
@@ -702,7 +700,7 @@
      * Move the page down by limit!
      */
     pageDown : function () {
-      this.screen(this._offset + this.limit());
+      this.screen(this.offset + this.limit());
     },
 
 
@@ -715,15 +713,6 @@
       };
     },
 
-
-    // Reset chosen item and prefix
-    _reset : function () {
-      this._offset = 0;
-      this.position = 0;
-      this._prefix.clear();
-    },
-
-
     // Set boundary for viewport
     _boundary : function (bool) {
       this.item(this._list[0]).noMore(bool);
@@ -735,21 +724,27 @@
     _showItems : function (off) {
 
       // optimization: scroll down one step
-      if (this._offset === (off - 1)) {
-	this._offset = off;
-	this._removeFirst();
-	var pos = this._offset + this.limit() - 1;
+      if (this.offset === (off - 1)) {
+	this.offset = off;
+
+	// Remove the HTML node from the first item
+	// leave lengthField/prefix/slider
+	this._element.removeChild(this._element.children[3]);
+	var pos = this.offset + this.limit() - 1;
 	this._append(this._list[pos]);
       }
 
       // optimization: scroll up one step
-      else if (this._offset === (off + 1)) {
-	this._offset = off;
-	this._removeLast();
-	this._prepend(this._list[this._offset]);
+      else if (this.offset === (off + 1)) {
+	this.offset = off;
+
+	// Remove the HTML node from the last item
+	this._element.removeChild(this._element.lastChild);
+
+	this._prepend(this._list[this.offset]);
       }
       else {
-	this._offset = off;
+	this.offset = off;
 
 	// Remove all items
 	this.removeItems();
@@ -775,7 +770,7 @@
       };
 
       // set the slider to the new offset
-      this._slider.offset(this._offset);
+      this._slider.offset(this.offset);
     },
 
 
@@ -804,26 +799,12 @@
       };
 
       var e = this.element();
+
       // Append element after lengthField/prefix/slider
       e.insertBefore(
 	item.element(),
 	e.children[3]
       );
-    },
-
-
-    // Remove the HTML node from the first item
-    _removeFirst : function () {
-      // this.item(this._list[this._offset]).lowlight();
-      // leave lengthField/prefix/slider
-      this._element.removeChild(this._element.children[3]);
-    },
-
-
-    // Remove the HTML node from the last item
-    _removeLast : function () {
-      // this.item(this._list[this._offset + this.limit() - 1]).lowlight();
-      this._element.removeChild(this._element.lastChild);
     }
   };
 });
diff --git a/dev/js/src/menu/slider.js b/dev/js/src/menu/slider.js
index 0b0aed0..baef16a 100644
--- a/dev/js/src/menu/slider.js
+++ b/dev/js/src/menu/slider.js
@@ -1,32 +1,56 @@
+/**
+ * Create slider for menus.
+ * The slider will only be used by mouse - touch support
+ * shouldn't be necessary, as the menu can be scrolled using touch.
+ *
+ * @author Nils Diewald
+ */
 define({
 
   /**
-   * Create new slider object.
-   * The slider will only be used by mouse - touch support
-   * shouldn't be necessary.
+   * Create new slider for Menu.
+   * @this {Slider}
+   * @constructor
+   * @param {Menu} menu object
    */
   create : function (menu) {
     return Object.create(this)._init(menu);
   },
 
+  /**
+   * Length attribute of the slider
+   * (as number of items).
+   *
+   * @param {number} Number of items (optional)
+   */
   length : function (i) {
     if (arguments.length === 0)
       return this._length;
     if (i == this._length)
-      return;
+      return this;
     this._length = i;
-    this._initSize();
+    return this;
   },
 
+  /**
+   * Limit of items per screen.
+   *
+   * @param {number} Number of items per screen (optional)
+   */
   limit : function (i) {
     if (arguments.length === 0)
       return this._limit;
     if (i == this._limit)
-      return;
+      return this;
     this._limit = i;
-    this._initSize();
+    return this;
   },
 
+  /**
+   * Is the slider active or not.
+   *
+   * @param {bool} true or false (optional)
+   */
   active : function (bool) {
     if (arguments.length === 1) {
       if (bool) {
@@ -43,6 +67,11 @@
     return this._active;
   },
 
+  /**
+   * Move the slider to a relative position
+   *
+   * @param {number} relative position
+   */
   movetoRel : function (relativePos) {
     var diffHeight = (this._rulerHeight - this._sliderHeight);
     var relativeOffset = (relativePos / diffHeight);
@@ -53,6 +82,11 @@
     };
   },
 
+  /**
+   * Move the slider to an absolute position
+   *
+   * @param {number} absolute position
+   */
   movetoAbs : function (absPos) {
     var absOffset = (absPos / this._rulerHeight);
 
@@ -62,30 +96,61 @@
     };
   },
 
+  /**
+   * Screen offset of the slider
+   *
+   * @param {number} Offset position of the slider (optional)
+   */
   offset : function (off) {
     if (arguments.length === 0)
       return this._offset;
 
-    if (off > this._screens) {
+    // Normalize offset
+    if (off > this._screens)
       off = this._screens;
-    }
-    else if (off < 0) {
+    else if (off < 0)
       off = 0;
-    };
 
+    // Identical with old value
     if (off === this._offset)
       return undefined;
 
+    // Set offset and move
     this._offset = off;
     this._slider.style.top = (this._step * off) + '%';
-
     return off;
   },
 
+  /**
+   * Get the associated dom element.
+   */
   element : function () {
     return this._element;
   },
 
+  /**
+   * Reinitialize the size of the slider.
+   * Necessary to call after each adjustment of the list.
+   */
+  reInit : function () {
+
+    var s = this._element.style;
+
+    // Do not show the slider, in case there is nothing to scroll
+    if (this._length <= this._limit) {
+      s.display = 'none';
+      return;
+    }
+    else {
+      s.display = 'block';
+    };
+
+    this._height  = ((this._limit / this._length) * 100);
+    this._screens = this._length - this._limit;
+    this._step    = (100 - this._height) / this._screens;
+    this._slider.style.height = this._height + '%';
+  },
+
   // Initialize prefix object
   _init : function (menu) {
 
@@ -95,14 +160,14 @@
     this._event = {};
     this._active = false;
 
-    this._element = document.createElement('div');
-    this._element.setAttribute('class', 'ruler');
+    var el = this._element = document.createElement('div');
+    el.setAttribute('class', 'ruler');
 
-    this._slider = this._element.appendChild(
+    this._slider = el.appendChild(
       document.createElement('span')
     );
 
-    this._ruler = this._element.appendChild(document.createElement('div'));
+    this._ruler = el.appendChild(document.createElement('div'));
 
     // Do not mark the menu on mousedown
     this._ruler.addEventListener('mousedown', function (e) {
@@ -117,32 +182,19 @@
     return this;
   },
 
-  _initSize : function () {
-    if (this._length <= this._limit) {
-      this._element.style.display = 'none';
-      return;
-    }
-    else {
-      this._element.style.display = 'block';
-    };
-
-    this._height = ((this._limit / this._length) * 100);
-    this._screens = this._length - this._limit;
-    this._step = (100 - this._height) / this._screens;
-    this._slider.style.height = this._height + '%';
-  },
-
+  // Reinit height based on dom position
   _initClientHeight : function () {
-    this._rulerHeight  = this._element.clientHeight; // offsetHeight?
-    this._sliderHeight = this._slider.clientHeight;  // offsetHeight?
+    this._rulerHeight  = this._element.clientHeight;
+    this._sliderHeight = this._slider.clientHeight;
   },
 
+  // Release mousemove event
   _mousemove : function (e) {
     this.movetoRel(e.clientY - this._event.init);
     e.halt();
-    // Support touch!
   },
 
+  // Release mouseup event
   _mouseup : function (e) {
     this.active(false);
     window.removeEventListener('mousemove', this._event.mov);
@@ -150,12 +202,13 @@
     this._menu.focus();
   },
 
+  // Release mousedown event
   _mousedown : function (e) {
     // Bind drag handler
     var ev = this._event;
     ev.init = e.clientY - (this._step * this._offset);
-    ev.mov = this._mousemove.bind(this);
-    ev.up = this._mouseup.bind(this);
+    ev.mov  = this._mousemove.bind(this);
+    ev.up   = this._mouseup.bind(this);
 
     // TODO: This may not be necessary all the time
     this._initClientHeight();
@@ -168,6 +221,7 @@
     e.halt();
   },
 
+  // Release event to reposition slider on ruler
   _mouseclick : function (e) {
     this._initClientHeight();
 
