diff --git a/public/js/demo/vc.html b/public/js/demo/vc.html
index 9254d68..ea4a53c 100644
--- a/public/js/demo/vc.html
+++ b/public/js/demo/vc.html
@@ -3,6 +3,7 @@
   <head>
     <title>Virtual Collection demo</title>
     <meta charset="utf-8" />
+    <script src="../src/menu.js"></script>
     <script src="../src/vc.js"></script>
     <link href="../../css/vc.css" rel="stylesheet" type="text/css"></link>
     <style type="text/css" rel="stylesheet">
@@ -16,46 +17,47 @@
   </head>
   <body>
     <div id="vc"></div>
+    <div id="menu"></div>
 
     <script>
     var json = {
-      "@type":"korap:docGroup",
+      "@type":"koral:docGroup",
       "operation":"operation:or",
       "operands":[
         {
-          "@type":"korap:docGroup",
+          "@type":"koral:docGroup",
           "operation":"operation:and",
           "operands":[
             {
-              "@type":"korap:doc",
+              "@type":"koral:doc",
               "key":"Titel",
               "value":"Baum",
               "match":"match:eq"
             },
             {
-              "@type":"korap:doc",
+              "@type":"koral:doc",
               "key":"Veröffentlichungsort",
               "value":"hihi",
               "match":"match:eq"
             },
             {
-              "@type":"korap:docGroup",
+              "@type":"koral:docGroup",
               "operation":"operation:or",
               "operands":[
                 {
-                  "@type":"korap:doc",
+                  "@type":"koral:doc",
                   "key":"Titel",
                   "value":"Baum",
                   "match":"match:eq"
                 },
                 {
-                  "@type":"korap:doc",
+                  "@type":"koral:doc",
                   "key":"Veröffentlichungsort",
                   "value":"hihi",
                   "match":"match:eq",
                   "rewrites" : [
                     {
-                      "@type": "korap:rewrite",
+                      "@type": "koral:rewrite",
                       "src" : "policy",
                       "operation" : "operation:injection",
                     }
@@ -66,7 +68,7 @@
           ]
         },
         {
-          "@type":"korap:doc",
+          "@type":"koral:doc",
           "key":"Untertitel",
           "value":"huhu",
           "match":"match:eq"
@@ -87,6 +89,19 @@
       document.getElementById("query").innerHTML = vc.root().toQuery();
     };
 
+    var menu = KorAP.FieldMenu.create([
+      ['Titel', 'title', 'string'],
+      ['Untertitel', 'subTitle', 'string'],
+      ['Veröffentlichungsdatum', 'pubDate', 'date']
+    ]);
+    menu.limit(4);
+    menu.show();
+
+    document.getElementById('menu').appendChild(menu.element());
+
+    menu.focus();
+
+
     </script>
 
     <hr />
diff --git a/public/js/runner/vc.html b/public/js/runner/vc.html
index e010587..f0e8179 100644
--- a/public/js/runner/vc.html
+++ b/public/js/runner/vc.html
@@ -8,6 +8,7 @@
   <script src="../lib/jasmine-2.1.1/jasmine.js"></script>
   <script src="../lib/jasmine-2.1.1/jasmine-html.js"></script>
   <script src="../lib/jasmine-2.1.1/boot.js"></script>
+  <script src="../src/menu.js"></script>
   <script src="../src/vc.js"></script>
   <script src="../spec/vcSpec.js"></script>
 </head>
diff --git a/public/js/spec/hintSpec.js b/public/js/spec/hintSpec.js
index 80807ff..a7232d4 100644
--- a/public/js/spec/hintSpec.js
+++ b/public/js/spec/hintSpec.js
@@ -705,4 +705,81 @@
     var hint = KorAP.Hint.create();
   });
 });
+
+
+describe('KorAP.ContextAnalyzer', function () {
+
+  it('should be initializable', function () {
+    var analyzer = KorAP.ContextAnalyzer.create(")");
+    expect(analyzer).toBe(undefined);
+
+    analyzer = KorAP.ContextAnalyzer.create(".+?");
+    expect(analyzer).not.toBe(undefined);
+
+  });
+
+  it('should check correctly', function () {
+    analyzer = KorAP.ContextAnalyzer.create(KorAP.context);
+    expect(analyzer.test("cnx/]cnx/c=")).toEqual("cnx/c=");
+    expect(analyzer.test("cnx/c=")).toEqual("cnx/c=");
+    expect(analyzer.test("cnx/c=np mate/m=mood:")).toEqual("mate/m=mood:");
+    expect(analyzer.test("impcnx/")).toEqual("impcnx/");
+    expect(analyzer.test("cnx/c=npcnx/")).toEqual("npcnx/");
+    expect(analyzer.test("mate/m=degree:pos corenlp/ne_dewac_175m_600="))
+      .toEqual("corenlp/ne_dewac_175m_600=");
+  });
+});
+
+describe('KorAP.InputField', function () {
+  var input;
+
+  beforeAll(function () {
+    input = document.createElement("input");
+    input.setAttribute("type", "text");
+    input.setAttribute("value", "abcdefghijklmno");
+    input.style.position = 'absolute';
+    input.style.top  = "20px";
+    input.style.left = "30px";
+    input.focus();
+    input.selectionStart = 5;
+  });
+
+  afterAll(function () {
+    document.getElementsByTagName("body")[0].removeChild(input);
+    document.getElementsByTagName("body")[0].removeChild(
+      document.getElementById("searchMirror")
+    );
+  });
+
+  it('should be initializable', function () {
+    // Supports: context, searchField
+    var inputField = KorAP.InputField.create(input);
+    expect(inputField._element).not.toBe(undefined);
+  });
+
+  it('should have text', function () {
+    var inputField = KorAP.InputField.create(input);
+
+    expect(inputField.value).toEqual("abcdefghijklmno");
+    expect(inputField.element.selectionStart).toEqual(5);
+    expect(inputField.split()[0]).toEqual("abcde");
+    expect(inputField.split()[1]).toEqual("fghijklmno");
+
+    inputField.insert("xyz");
+    expect(inputField.split()[0]).toEqual("abcdexyz");
+    expect(inputField.split()[1]).toEqual("fghijklmno");
+
+  });
+
+  it('should be correctly positioned', function () {
+    var inputField = KorAP.InputField.create(input);
+    document.getElementsByTagName("body")[0].appendChild(input);
+    inputField.reposition();
+    expect(inputField.mirror.style.left).toEqual("30px");
+    expect(inputField.mirror.style.top.match(/^(\d+)px$/)[1]).toBeGreaterThan(20);
+  });
+});
+
+
+
 */
diff --git a/public/js/spec/menuSpec.js b/public/js/spec/menuSpec.js
index 98f6e72..cc569a8 100644
--- a/public/js/spec/menuSpec.js
+++ b/public/js/spec/menuSpec.js
@@ -1,3 +1,4 @@
+// The OwnMenu item
 KorAP.OwnMenuItem = {
   create : function (params) {
     return Object.create(KorAP.MenuItem).upgradeTo(KorAP.OwnMenuItem)._init(params);
@@ -19,36 +20,8 @@
   }
 };
 
-KorAP.ComplexMenuItem = {
-  create : function (params) {
-    return Object.create(KorAP.MenuItem)
-      .upgradeTo(KorAP.ComplexMenuItem)
-      ._init(params);
-  },
-  content : function (content) {
-    if (arguments.length === 1) {
-      this._content = content;
-    };
-    return this._content;
-  },
-  _init : function (params) {
-    if (params[0] === undefined)
-      throw new Error("Missing parameters");
 
-    var r = document.createElement('div');
-    for (var i = 1; i <= params.length; i++) {
-      var h = document.createElement('h' + i);
-      h.appendChild(document.createTextNode(params[i-1]));
-      r.appendChild(h);
-    };
-
-    this._content = r;
-    this._lcField = ' ' + this.content().textContent.toLowerCase();
-
-    return this;
-  }
-};
-
+// The OwnMenu
 KorAP.OwnMenu = {
   create : function (params) {
     return Object.create(KorAP.Menu)
@@ -58,17 +31,7 @@
 };
 
 
-// Support for hint
-KorAP.HintMenu = {
-  create : function (context, params) {
-    var obj = Object.create(KorAP.Menu)
-      .upgradeTo(KorAP.HintMenu)
-      ._init(KorAP.HintMenuItem, params);
-    obj._context = context;
-    return obj;
-  }
-};
-
+// HintMenuItem
 KorAP.HintMenuItem = {
   create : function (params) {
    return Object.create(KorAP.MenuItem)
@@ -131,6 +94,50 @@
 };
 
 
+// HintMenu
+KorAP.HintMenu = {
+  create : function (context, params) {
+    var obj = Object.create(KorAP.Menu)
+      .upgradeTo(KorAP.HintMenu)
+      ._init(KorAP.HintMenuItem, params);
+    obj._context = context;
+    return obj;
+  }
+};
+
+
+// The ComplexMenuItem
+KorAP.ComplexMenuItem = {
+  create : function (params) {
+    return Object.create(KorAP.MenuItem)
+      .upgradeTo(KorAP.ComplexMenuItem)
+      ._init(params);
+  },
+  content : function (content) {
+    if (arguments.length === 1) {
+      this._content = content;
+    };
+    return this._content;
+  },
+  _init : function (params) {
+    if (params[0] === undefined)
+      throw new Error("Missing parameters");
+
+    var r = document.createElement('div');
+    for (var i = 1; i <= params.length; i++) {
+      var h = document.createElement('h' + i);
+      h.appendChild(document.createTextNode(params[i-1]));
+      r.appendChild(h);
+    };
+
+    this._content = r;
+    this._lcField = ' ' + this.content().textContent.toLowerCase();
+
+    return this;
+  }
+};
+
+
 
 describe('KorAP.MenuItem', function () {
   it('should be initializable', function () {
@@ -305,6 +312,14 @@
 
 
 describe('KorAP.Menu', function () {
+  var list = [
+    ["Constituency", "c=", "Example 1"],
+    ["Lemma", "l="],
+    ["Morphology", "m=", "Example 2"],
+    ["Part-of-Speech", "p="],
+    ["Syntax", "syn="]
+  ];
+
   it('should be initializable', function () {
     var list = [
       ["Constituency"],
@@ -342,13 +357,6 @@
   });
 
   it('should be visible', function () {
-    var list = [
-      ["Constituency", "c=", "Example 1"],
-      ["Lemma", "l="],
-      ["Morphology", "m=", "Example 2"],
-      ["Part-of-Speech", "p="],
-      ["Syntax", "syn="]
-    ];
     var menu = KorAP.HintMenu.create("cnx/", list);
     expect(menu.delete()).toBe(undefined);
     menu.limit(3);
@@ -368,14 +376,6 @@
   });
 
   it('should be filterable', function () {
-    var list = [
-      ["Constituency", "c=", "Example 1"],
-      ["Lemma", "l="],
-      ["Morphology", "m=", "Example 2"],
-      ["Part-of-Speech", "p="],
-      ["Syntax", "syn="]
-    ];
-
     var menu = KorAP.HintMenu.create("cnx/", list);
     menu.limit(3);
 
@@ -421,14 +421,6 @@
 
 
   it('should be nextable', function () {
-    var list = [
-      ["Constituency", "c=", "Example 1"],
-      ["Lemma", "l="],
-      ["Morphology", "m=", "Example 2"],
-      ["Part-of-Speech", "p="],
-      ["Syntax", "syn="]
-    ];
-
     var menu = KorAP.HintMenu.create("cnx/", list);
 
     // Show only 3 items
@@ -464,332 +456,249 @@
     expect(menu.element().childNodes[3]).toBe(undefined);
 
     // Activate next (3)
+    // scroll!
     menu.next();
-//    expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Lemma</strong>");
+    expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Lemma</strong>");
+
     expect(menu.shownItem(0).active()).toBe(false);
-//    expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
+    expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
     expect(menu.shownItem(1).active()).toBe(false);
-//    expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Part-of-Speech</strong>");
+    expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Part-of-Speech</strong>");
     expect(menu.shownItem(2).active()).toBe(true);
     expect(menu.element().childNodes[3]).toBe(undefined);
-  });
-});
-
-
-/*
-describe('KorAP.Menu', function () {
-
-
 
     // Activate next (4)
     menu.next();
-    expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
+    expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
     expect(menu.shownItem(0).active()).toBe(false);
-    expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Part-of-Speech</strong>");
+    expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Part-of-Speech</strong>");
     expect(menu.shownItem(1).active()).toBe(false);
-    expect(menu.element.childNodes[2].innerHTML).toEqual("<strong>Syntax</strong>");
+    expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Syntax</strong>");
     expect(menu.shownItem(2).active()).toBe(true);
-    expect(menu.element.childNodes[3]).toBe(undefined);
+    expect(menu.element().childNodes[3]).toBe(undefined);
 
     // Activate next (5) - ROLL
     menu.next();
-    expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span>Example 1</span>");
+    expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span>Example 1</span>");
     expect(menu.shownItem(0).active()).toBe(true);
-    expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Lemma</strong>");
+    expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Lemma</strong>");
     expect(menu.shownItem(1).active()).toBe(false);
-    expect(menu.element.childNodes[2].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
+    expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
     expect(menu.shownItem(2).active()).toBe(false);
-    expect(menu.element.childNodes[3]).toBe(undefined);
+    expect(menu.element().childNodes[3]).toBe(undefined);
 
     // Active next (6)
     menu.next();
-    expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span>Example 1</span>");
+    expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span>Example 1</span>");
     expect(menu.shownItem(0).active()).toBe(false);
-    expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Lemma</strong>");
+    expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Lemma</strong>");
     expect(menu.shownItem(1).active()).toBe(true);
-    expect(menu.element.childNodes[2].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
+    expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
     expect(menu.shownItem(2).active()).toBe(false);
-    expect(menu.element.childNodes[3]).toBe(undefined);
-
+    expect(menu.element().childNodes[3]).toBe(undefined);
   });
 
-
   it('should be prevable', function () {
-    var menu = KorAP.Menu.create("cnx/", list);
+    var menu = KorAP.HintMenu.create("cnx/", list);
 
-    KorAP.limit = 3;
+    menu.limit(3);
     expect(menu.show()).toBe(undefined);
 
-    expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span>Example 1</span>");
+    expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span>Example 1</span>");
     expect(menu.shownItem(0).active()).toBe(true);
-    expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Lemma</strong>");
+    expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Lemma</strong>");
     expect(menu.shownItem(1).active()).toBe(false);
-    expect(menu.element.childNodes[2].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
+    expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
     expect(menu.shownItem(2).active()).toBe(false);
-    expect(menu.element.childNodes[3]).toBe(undefined);
+    expect(menu.element().childNodes[3]).toBe(undefined);
 
     // Activate prev (1) - roll to bottom
     menu.prev();
-    expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
+    expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
     expect(menu.shownItem(0).active()).toBe(false);
-    expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Part-of-Speech</strong>");
+    expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Part-of-Speech</strong>");
     expect(menu.shownItem(1).active()).toBe(false);
-    expect(menu.element.childNodes[2].innerHTML).toEqual("<strong>Syntax</strong>");
+    expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Syntax</strong>");
     expect(menu.shownItem(2).active()).toBe(true);
-    expect(menu.element.childNodes[3]).toBe(undefined);
+    expect(menu.element().childNodes[3]).toBe(undefined);
 
     // Activate prev (2)
     menu.prev();
-    expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
+    expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Morphology</strong><span>Example 2</span>");
     expect(menu.shownItem(0).active()).toBe(false);
-    expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Part-of-Speech</strong>");
+    expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Part-of-Speech</strong>");
     expect(menu.shownItem(1).active()).toBe(true);
-    expect(menu.element.childNodes[2].innerHTML).toEqual("<strong>Syntax</strong>");
+    expect(menu.element().childNodes[2].innerHTML).toEqual("<strong>Syntax</strong>");
     expect(menu.shownItem(2).active()).toBe(false);
-    expect(menu.element.childNodes[3]).toBe(undefined);
+    expect(menu.element().childNodes[3]).toBe(undefined);
 
     // Activate prev (3)
     menu.prev();
-    expect(menu.shownItem(0).name).toEqual("Morphology");
+    expect(menu.shownItem(0).name()).toEqual("Morphology");
     expect(menu.shownItem(0).active()).toBe(true);
-    expect(menu.shownItem(1).name).toEqual("Part-of-Speech");
+    expect(menu.shownItem(1).name()).toEqual("Part-of-Speech");
     expect(menu.shownItem(1).active()).toBe(false);
-    expect(menu.shownItem(2).name).toEqual("Syntax");
+    expect(menu.shownItem(2).name()).toEqual("Syntax");
     expect(menu.shownItem(2).active()).toBe(false);
-    expect(menu.element.childNodes[3]).toBe(undefined);
+    expect(menu.element().childNodes[3]).toBe(undefined);
 
     // Activate prev (4)
     menu.prev();
-    expect(menu.shownItem(0).name).toEqual("Lemma");
+    expect(menu.shownItem(0).name()).toEqual("Lemma");
     expect(menu.shownItem(0).active()).toBe(true);
-    expect(menu.shownItem(1).name).toEqual("Morphology");
+    expect(menu.shownItem(1).name()).toEqual("Morphology");
     expect(menu.shownItem(1).active()).toBe(false);
-    expect(menu.shownItem(2).name).toEqual("Part-of-Speech");
+    expect(menu.shownItem(2).name()).toEqual("Part-of-Speech");
     expect(menu.shownItem(2).active()).toBe(false);
-    expect(menu.element.childNodes[3]).toBe(undefined);
+    expect(menu.element().childNodes[3]).toBe(undefined);
 
     // Activate prev (5)
     menu.prev();
-    expect(menu.shownItem(0).name).toEqual("Constituency");
+    expect(menu.shownItem(0).name()).toEqual("Constituency");
     expect(menu.shownItem(0).active()).toBe(true);
-    expect(menu.shownItem(1).name).toEqual("Lemma");
+    expect(menu.shownItem(1).name()).toEqual("Lemma");
     expect(menu.shownItem(1).active()).toBe(false);
-    expect(menu.shownItem(2).name).toEqual("Morphology");
+    expect(menu.shownItem(2).name()).toEqual("Morphology");
     expect(menu.shownItem(2).active()).toBe(false);
-    expect(menu.element.childNodes[3]).toBe(undefined);
+    expect(menu.element().childNodes[3]).toBe(undefined);
 
     // Activate next (1)
     menu.next();
-    expect(menu.shownItem(0).name).toEqual("Constituency");
+    expect(menu.shownItem(0).name()).toEqual("Constituency");
     expect(menu.shownItem(0).active()).toBe(false);
-    expect(menu.shownItem(1).name).toEqual("Lemma");
+    expect(menu.shownItem(1).name()).toEqual("Lemma");
     expect(menu.shownItem(1).active()).toBe(true);
-    expect(menu.shownItem(2).name).toEqual("Morphology");
+    expect(menu.shownItem(2).name()).toEqual("Morphology");
     expect(menu.shownItem(2).active()).toBe(false);
-    expect(menu.element.childNodes[3]).toBe(undefined);
+    expect(menu.element().childNodes[3]).toBe(undefined);
 
     // Activate prev (6)
     menu.prev();
 
     // Activate prev (7)
     menu.prev();
-    expect(menu.shownItem(0).name).toEqual("Morphology");
+    expect(menu.shownItem(0).name()).toEqual("Morphology");
     expect(menu.shownItem(0).active()).toBe(false);
-    expect(menu.shownItem(1).name).toEqual("Part-of-Speech");
+    expect(menu.shownItem(1).name()).toEqual("Part-of-Speech");
     expect(menu.shownItem(1).active()).toBe(false);
-    expect(menu.shownItem(2).name).toEqual("Syntax");
+    expect(menu.shownItem(2).name()).toEqual("Syntax");
     expect(menu.shownItem(2).active()).toBe(true);
-    expect(menu.element.childNodes[3]).toBe(undefined);
+    expect(menu.element().childNodes[3]).toBe(undefined);
   });
 
-  it('should be navigatable and filterable (prefix = "o")', function () {
-    var menu = KorAP.Menu.create("cnx/", list);
 
-    KorAP.limit = 2;
+  it('should be navigatable and filterable (prefix = "o")', function () {
+    var menu = KorAP.HintMenu.create("cnx/", list);
+    menu.limit(2);
 
     expect(menu.show("o")).toBe(undefined);
 
-    expect(menu.shownItem(0).name).toEqual("Constituency");
-    expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>C<em>o</em>nstituency</strong><span>Example 1</span>");
+    expect(menu.shownItem(0).name()).toEqual("Constituency");
+    expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>C<mark>o</mark>nstituency</strong><span>Example 1</span>");
     expect(menu.shownItem(0).active()).toBe(true);
-    expect(menu.shownItem(1).name).toEqual("Morphology");
-    expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>M<em>o</em>rphology</strong><span>Example 2</span>");
+    expect(menu.shownItem(1).name()).toEqual("Morphology");
+    expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>M<mark>o</mark>rph<mark>o</mark>l<mark>o</mark>gy</strong><span>Example 2</span>");
     expect(menu.shownItem(1).active()).toBe(false);
     expect(menu.shownItem(2)).toBe(undefined);
 
     // Next (1)
     menu.next();
-    expect(menu.shownItem(0).name).toEqual("Constituency");
-    expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>C<em>o</em>nstituency</strong><span>Example 1</span>");
+    expect(menu.shownItem(0).name()).toEqual("Constituency");
+    expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>C<mark>o</mark>nstituency</strong><span>Example 1</span>");
     expect(menu.shownItem(0).active()).toBe(false);
-    expect(menu.shownItem(1).name).toEqual("Morphology");
-    expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>M<em>o</em>rphology</strong><span>Example 2</span>");
+    expect(menu.shownItem(1).name()).toEqual("Morphology");
+    expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>M<mark>o</mark>rph<mark>o</mark>l<mark>o</mark>gy</strong><span>Example 2</span>");
     expect(menu.shownItem(1).active()).toBe(true);
     expect(menu.shownItem(2)).toBe(undefined);
 
-
     // Next (2)
     menu.next();
-    expect(menu.shownItem(0).name).toEqual("Morphology");
-    expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>M<em>o</em>rphology</strong><span>Example 2</span>");
+    expect(menu.shownItem(0).name()).toEqual("Morphology");
+    expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>M<mark>o</mark>rph<mark>o</mark>l<mark>o</mark>gy</strong><span>Example 2</span>");
     expect(menu.shownItem(0).active()).toBe(false);
-    expect(menu.shownItem(1).name).toEqual("Part-of-Speech");
-    expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Part-<em>o</em>f-Speech</strong>");
+    expect(menu.shownItem(1).name()).toEqual("Part-of-Speech");
+    expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Part-<mark>o</mark>f-Speech</strong>");
     expect(menu.shownItem(1).active()).toBe(true);
     expect(menu.shownItem(2)).toBe(undefined);
 
     // Next (3)
     menu.next();
-    expect(menu.shownItem(0).name).toEqual("Constituency");
-    expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>C<em>o</em>nstituency</strong><span>Example 1</span>");
+    expect(menu.shownItem(0).name()).toEqual("Constituency");
+    expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>C<mark>o</mark>nstituency</strong><span>Example 1</span>");
     expect(menu.shownItem(0).active()).toBe(true);
-    expect(menu.shownItem(1).name).toEqual("Morphology");
-    expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>M<em>o</em>rphology</strong><span>Example 2</span>");
+    expect(menu.shownItem(1).name()).toEqual("Morphology");
+    expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>M<mark>o</mark>rph<mark>o</mark>l<mark>o</mark>gy</strong><span>Example 2</span>");
     expect(menu.shownItem(1).active()).toBe(false);
     expect(menu.shownItem(2)).toBe(undefined);
   });
 
+
   it('should be navigatable and filterable (prefix = "ex", "e")', function () {
-    var menu = KorAP.Menu.create("cnx/", list);
+    var menu = KorAP.HintMenu.create("cnx/", list);
 
-    KorAP.limit = 2;
-
+    menu.limit(2);
     expect(menu.show("ex")).toBe(undefined);
 
-    expect(menu.shownItem(0).name).toEqual("Constituency");
-    expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span><em>Ex</em>ample 1</span>");
+    expect(menu.shownItem(0).name()).toEqual("Constituency");
+    expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span><mark>Ex</mark>ample 1</span>");
     expect(menu.shownItem(0).active()).toBe(true);
-    expect(menu.shownItem(1).name).toEqual("Morphology");
-    expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><em>Ex</em>ample 2</span>");
+    expect(menu.shownItem(1).name()).toEqual("Morphology");
+    expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><mark>Ex</mark>ample 2</span>");
     expect(menu.shownItem(1).active()).toBe(false);
     expect(menu.shownItem(2)).toBe(undefined);
 
     // Next (1)
     menu.next();
-    expect(menu.shownItem(0).name).toEqual("Constituency");
-    expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span><em>Ex</em>ample 1</span>");
+    expect(menu.shownItem(0).name()).toEqual("Constituency");
+    expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span><mark>Ex</mark>ample 1</span>");
     expect(menu.shownItem(0).active()).toBe(false);
-    expect(menu.shownItem(1).name).toEqual("Morphology");
-    expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><em>Ex</em>ample 2</span>");
+    expect(menu.shownItem(1).name()).toEqual("Morphology");
+    expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><mark>Ex</mark>ample 2</span>");
     expect(menu.shownItem(1).active()).toBe(true);
     expect(menu.shownItem(2)).toBe(undefined);
 
     // Next (2)
     menu.next();
-    expect(menu.shownItem(0).name).toEqual("Constituency");
-    expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span><em>Ex</em>ample 1</span>");
+    expect(menu.shownItem(0).name()).toEqual("Constituency");
+    expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Constituency</strong><span><mark>Ex</mark>ample 1</span>");
     expect(menu.shownItem(0).active()).toBe(true);
-    expect(menu.shownItem(1).name).toEqual("Morphology");
-    expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><em>Ex</em>ample 2</span>");
+    expect(menu.shownItem(1).name()).toEqual("Morphology");
+    expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><mark>Ex</mark>ample 2</span>");
     expect(menu.shownItem(1).active()).toBe(false);
     expect(menu.shownItem(2)).toBe(undefined);
 
     // Reset limit
-    KorAP.limit = 5;
+    menu.limit(5);
 
     // Change show
     expect(menu.show("e")).toBe(undefined);
 
-    expect(menu.shownItem(0).name).toEqual("Constituency");
-    expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Constitu<em>e</em>ncy</strong><span><em>E</em>xample 1</span>");
+    expect(menu.shownItem(0).name()).toEqual("Constituency");
+    expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Constitu<mark>e</mark>ncy</strong><span><mark>E</mark>xampl<mark>e</mark> 1</span>");
     expect(menu.shownItem(0).active()).toBe(true);
-    expect(menu.shownItem(1).name).toEqual("Morphology");
-    expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><em>E</em>xample 2</span>");
+    expect(menu.shownItem(1).name()).toEqual("Morphology");
+    expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><mark>E</mark>xampl<mark>e</mark> 2</span>");
     expect(menu.shownItem(1).active()).toBe(false);
     expect(menu.shownItem(2)).toBe(undefined);
 
     // Next (1)
     menu.next();
-    expect(menu.shownItem(0).name).toEqual("Constituency");
-    expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Constitu<em>e</em>ncy</strong><span><em>E</em>xample 1</span>");
+    expect(menu.shownItem(0).name()).toEqual("Constituency");
+    expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Constitu<mark>e</mark>ncy</strong><span><mark>E</mark>xampl<mark>e</mark> 1</span>");
     expect(menu.shownItem(0).active()).toBe(false);
-    expect(menu.shownItem(1).name).toEqual("Morphology");
-    expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><em>E</em>xample 2</span>");
+    expect(menu.shownItem(1).name()).toEqual("Morphology");
+    expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><mark>E</mark>xampl<mark>e</mark> 2</span>");
     expect(menu.shownItem(1).active()).toBe(true);
     expect(menu.shownItem(2)).toBe(undefined);
 
     // Next (2)
     menu.next();
-    expect(menu.shownItem(0).name).toEqual("Constituency");
-    expect(menu.element.childNodes[0].innerHTML).toEqual("<strong>Constitu<em>e</em>ncy</strong><span><em>E</em>xample 1</span>");
+    expect(menu.shownItem(0).name()).toEqual("Constituency");
+    expect(menu.element().childNodes[0].innerHTML).toEqual("<strong>Constitu<mark>e</mark>ncy</strong><span><mark>E</mark>xampl<mark>e</mark> 1</span>");
     expect(menu.shownItem(0).active()).toBe(true);
-    expect(menu.shownItem(1).name).toEqual("Morphology");
-    expect(menu.element.childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><em>E</em>xample 2</span>");
+    expect(menu.shownItem(1).name()).toEqual("Morphology");
+    expect(menu.element().childNodes[1].innerHTML).toEqual("<strong>Morphology</strong><span><mark>E</mark>xampl<mark>e</mark> 2</span>");
     expect(menu.shownItem(1).active()).toBe(false);
     expect(menu.shownItem(2)).toBe(undefined);
   });
 });
-
-describe('KorAP.ContextAnalyzer', function () {
-
-  it('should be initializable', function () {
-    var analyzer = KorAP.ContextAnalyzer.create(")");
-    expect(analyzer).toBe(undefined);
-
-    analyzer = KorAP.ContextAnalyzer.create(".+?");
-    expect(analyzer).not.toBe(undefined);
-
-  });
-
-  it('should check correctly', function () {
-    analyzer = KorAP.ContextAnalyzer.create(KorAP.context);
-    expect(analyzer.test("cnx/]cnx/c=")).toEqual("cnx/c=");
-    expect(analyzer.test("cnx/c=")).toEqual("cnx/c=");
-    expect(analyzer.test("cnx/c=np mate/m=mood:")).toEqual("mate/m=mood:");
-    expect(analyzer.test("impcnx/")).toEqual("impcnx/");
-    expect(analyzer.test("cnx/c=npcnx/")).toEqual("npcnx/");
-    expect(analyzer.test("mate/m=degree:pos corenlp/ne_dewac_175m_600="))
-      .toEqual("corenlp/ne_dewac_175m_600=");
-  });
-});
-
-describe('KorAP.InputField', function () {
-  var input;
-
-  beforeAll(function () {
-    input = document.createElement("input");
-    input.setAttribute("type", "text");
-    input.setAttribute("value", "abcdefghijklmno");
-    input.style.position = 'absolute';
-    input.style.top  = "20px";
-    input.style.left = "30px";
-    input.focus();
-    input.selectionStart = 5;
-  });
-
-  afterAll(function () {
-    document.getElementsByTagName("body")[0].removeChild(input);
-    document.getElementsByTagName("body")[0].removeChild(
-      document.getElementById("searchMirror")
-    );
-  });
-
-  it('should be initializable', function () {
-    // Supports: context, searchField
-    var inputField = KorAP.InputField.create(input);
-    expect(inputField._element).not.toBe(undefined);
-  });
-
-  it('should have text', function () {
-    var inputField = KorAP.InputField.create(input);
-
-    expect(inputField.value).toEqual("abcdefghijklmno");
-    expect(inputField.element.selectionStart).toEqual(5);
-    expect(inputField.split()[0]).toEqual("abcde");
-    expect(inputField.split()[1]).toEqual("fghijklmno");
-
-    inputField.insert("xyz");
-    expect(inputField.split()[0]).toEqual("abcdexyz");
-    expect(inputField.split()[1]).toEqual("fghijklmno");
-
-  });
-
-  it('should be correctly positioned', function () {
-    var inputField = KorAP.InputField.create(input);
-    document.getElementsByTagName("body")[0].appendChild(input);
-    inputField.reposition();
-    expect(inputField.mirror.style.left).toEqual("30px");
-    expect(inputField.mirror.style.top.match(/^(\d+)px$/)[1]).toBeGreaterThan(20);
-  });
-});
-*/
diff --git a/public/js/spec/vcSpec.js b/public/js/spec/vcSpec.js
index 49e9275..1a24fb6 100644
--- a/public/js/spec/vcSpec.js
+++ b/public/js/spec/vcSpec.js
@@ -35,37 +35,37 @@
 };
 
 var demoFactory = buildFactory(KorAP.VirtualCollection, {
-  "@type":"korap:docGroup",
+  "@type":"koral:docGroup",
   "operation":"operation:or",
   "operands":[
     {
-      "@type":"korap:docGroup",
+      "@type":"koral:docGroup",
       "operation":"operation:and",
       "operands":[
         {
-          "@type":"korap:doc",
+          "@type":"koral:doc",
           "key":"Titel",
           "value":"Baum",
           "match":"match:eq"
         },
         {
-          "@type":"korap:doc",
+          "@type":"koral:doc",
           "key":"Veröffentlichungsort",
           "value":"hihi",
           "match":"match:eq"
         },
         {
-          "@type":"korap:docGroup",
+          "@type":"koral:docGroup",
           "operation":"operation:or",
           "operands":[
             {
-              "@type":"korap:doc",
+              "@type":"koral:doc",
               "key":"Titel",
               "value":"Baum",
               "match":"match:eq"
             },
             {
-              "@type":"korap:doc",
+              "@type":"koral:doc",
               "key":"Veröffentlichungsort",
               "value":"hihi",
               "match":"match:eq"
@@ -75,7 +75,7 @@
       ]
     },
     {
-      "@type":"korap:doc",
+      "@type":"koral:doc",
       "key":"Untertitel",
       "value":"huhu",
       "match":"match:eq"
@@ -90,7 +90,7 @@
   var stringFactory = buildFactory(KorAP.Doc, {
     "key"   : "author",
     "value" : "Max Birkendale",
-    "@type" : "korap:doc"
+    "@type" : "koral:doc"
   });
 
   // Create example factories
@@ -99,7 +99,7 @@
     "type"  : "type:date",
     "match" : "match:eq",
     "value" : "2014-11-05",
-    "@type" : "korap:doc"
+    "@type" : "koral:doc"
   });
 
   // Create example factories
@@ -107,7 +107,7 @@
     "key"   : "title",
     "type"  : "type:regex",
     "value" : "[^b]ee.+?",
-    "@type" : "korap:doc"
+    "@type" : "koral:doc"
   });
 
   it('should be initializable', function () {
@@ -251,7 +251,7 @@
     // Serialize string
     doc = stringFactory.create();
     expect(doc.toJson()).toEqual(jasmine.objectContaining({
-      "@type" : "korap:doc",
+      "@type" : "koral:doc",
       "type" : "type:string",
       "key" : "author",
       "value" : "Max Birkendale",
@@ -261,7 +261,7 @@
     // Serialize regex
     doc = regexFactory.create();
     expect(doc.toJson()).toEqual(jasmine.objectContaining({
-      "@type" : "korap:doc",
+      "@type" : "koral:doc",
       "type" : "type:regex",
       "value" : "[^b]ee.+?",
       "match" : "match:eq",
@@ -272,7 +272,7 @@
       match: "match:ne"
     });
     expect(doc.toJson()).toEqual(jasmine.objectContaining({
-      "@type" : "korap:doc",
+      "@type" : "koral:doc",
       "type" : "type:regex",
       "value" : "[^b]ee.+?",
       "match" : "match:ne",
@@ -281,7 +281,7 @@
 
     doc = dateFactory.create();
     expect(doc.toJson()).toEqual(jasmine.objectContaining({
-      "@type" : "korap:doc",
+      "@type" : "koral:doc",
       "type" : "type:date",
       "value" : "2014-11-05",
       "match" : "match:eq",
@@ -292,7 +292,7 @@
       value : "2014"
     });
     expect(doc.toJson()).toEqual(jasmine.objectContaining({
-      "@type" : "korap:doc",
+      "@type" : "koral:doc",
       "type" : "type:date",
       "value" : "2014",
       "match" : "match:eq",
@@ -339,7 +339,7 @@
   var docFactory = buildFactory(
     KorAP.Doc,
     {
-      "@type" : "korap:doc",
+      "@type" : "koral:doc",
       "match":"match:eq",
       "key" : "author",
       "value" : "Max Birkendale"
@@ -348,7 +348,7 @@
 
   var docGroupFactory = buildFactory(
     KorAP.DocGroup, {
-      "@type" : "korap:docGroup",
+      "@type" : "koral:docGroup",
       "operation" : "operation:and",
       "operands" : [
 	docFactory.create().toJson(),
@@ -455,18 +455,18 @@
     var docGroup = docGroupFactory.create();
 
     expect(docGroup.toJson()).toEqual(jasmine.objectContaining({
-      "@type" : "korap:docGroup",
+      "@type" : "koral:docGroup",
       "operation" : "operation:and",
       "operands" : [
 	{
-	  "@type": 'korap:doc',
+	  "@type": 'koral:doc',
 	  "key" : 'author',
 	  "match": 'match:eq',
 	  "value": 'Max Birkendale',
 	  "type": 'type:string'
 	},
 	{
-	  "@type": 'korap:doc',
+	  "@type": 'koral:doc',
 	  "key": 'pubDate',
 	  "match": 'match:eq',
 	  "value": '2014-12-05',
@@ -481,36 +481,36 @@
     expect(docGroup.toQuery()).toEqual('author = "Max Birkendale" & pubDate in 2014-12-05');
 
     docGroup = docGroupFactory.create({
-      "@type" : "korap:docGroup",
+      "@type" : "koral:docGroup",
       "operation" : "operation:or",
       "operands" : [
 	{
-	  "@type": 'korap:doc',
+	  "@type": 'koral:doc',
 	  "key" : 'author',
 	  "match": 'match:eq',
 	  "value": 'Max Birkendale',
 	  "type": 'type:string'
 	},
 	{
-	  "@type" : "korap:docGroup",
+	  "@type" : "koral:docGroup",
 	  "operation" : "operation:and",
 	  "operands" : [
 	    {
-	      "@type": 'korap:doc',
+	      "@type": 'koral:doc',
 	      "key": 'pubDate',
 	      "match": 'match:geq',
 	      "value": '2014-05-12',
 	      "type": 'type:date'
 	    },
 	    {
-	      "@type": 'korap:doc',
+	      "@type": 'koral:doc',
 	      "key": 'pubDate',
 	      "match": 'match:leq',
 	      "value": '2014-12-05',
 	      "type": 'type:date'
 	    },
 	    {
-	      "@type": 'korap:doc',
+	      "@type": 'koral:doc',
 	      "key": 'foo',
 	      "match": 'match:ne',
 	      "value": '[a]?bar',
@@ -545,7 +545,7 @@
     expect(docGroup.operation()).toEqual('or');
 
     docGroup.append({
-      "@type": 'korap:doc',
+      "@type": 'koral:doc',
       "key": 'pubDate',
       "match": 'match:eq',
       "value": '2014-12-05',
@@ -577,7 +577,7 @@
     expect(docGroup.operation()).toEqual('or');
 
     docGroup.append({
-      "@type": 'korap:doc',
+      "@type": 'koral:doc',
       "key": 'pubDate',
       "match": 'match:eq',
       "value": '2014-12-05',
@@ -643,7 +643,7 @@
 describe('KorAP.Doc element', function () {
   it('should be initializable', function () {
     var docElement = KorAP.Doc.create(undefined, {
-      "@type" : "korap:doc",
+      "@type" : "koral:doc",
       "key":"Titel",
       "value":"Baum",
       "match":"match:eq"
@@ -660,7 +660,7 @@
     expect(docE.children[2].getAttribute('data-type')).toEqual('string');
 
     expect(docElement.toJson()).toEqual(jasmine.objectContaining({
-      "@type" : "korap:doc",
+      "@type" : "koral:doc",
       "key":"Titel",
       "value":"Baum",
       "match":"match:eq"
@@ -672,18 +672,18 @@
   it('should be initializable', function () {
 
     var docGroup = KorAP.DocGroup.create(undefined, {
-      "@type" : "korap:docGroup",
+      "@type" : "koral:docGroup",
       "operation" : "operation:and",
       "operands" : [
 	{
-	  "@type": 'korap:doc',
+	  "@type": 'koral:doc',
 	  "key" : 'author',
 	  "match": 'match:eq',
 	  "value": 'Max Birkendale',
 	  "type": 'type:string'
 	},
 	{
-	  "@type": 'korap:doc',
+	  "@type": 'koral:doc',
 	  "key": 'pubDate',
 	  "match": 'match:eq',
 	  "value": '2014-12-05',
@@ -721,29 +721,29 @@
 
   it('should be deserializable with nested groups', function () {
     var docGroup = KorAP.DocGroup.create(undefined, {
-      "@type" : "korap:docGroup",
+      "@type" : "koral:docGroup",
       "operation" : "operation:or",
       "operands" : [
 	{
-	  "@type": 'korap:doc',
+	  "@type": 'koral:doc',
 	  "key" : 'author',
 	  "match": 'match:eq',
 	  "value": 'Max Birkendale',
 	  "type": 'type:string'
 	},
 	{
-	  "@type" : "korap:docGroup",
+	  "@type" : "koral:docGroup",
 	  "operation" : "operation:and",
 	  "operands" : [
 	    {
-	      "@type": 'korap:doc',
+	      "@type": 'koral:doc',
 	      "key": 'pubDate',
 	      "match": 'match:geq',
 	      "value": '2014-05-12',
 	      "type": 'type:date'
 	    },
 	    {
-	      "@type": 'korap:doc',
+	      "@type": 'koral:doc',
 	      "key": 'pubDate',
 	      "match": 'match:leq',
 	      "value": '2014-12-05',
@@ -787,18 +787,18 @@
 describe('KorAP.VirtualCollection', function () {
 
   var simpleGroupFactory = buildFactory(KorAP.DocGroup, {
-    "@type" : "korap:docGroup",
+    "@type" : "koral:docGroup",
     "operation" : "operation:and",
     "operands" : [
       {
-	"@type": 'korap:doc',
+	"@type": 'koral:doc',
 	"key" : 'author',
 	"match": 'match:eq',
 	"value": 'Max Birkendale',
 	"type": 'type:string'
       },
       {
-	"@type": 'korap:doc',
+	"@type": 'koral:doc',
 	"key": 'pubDate',
 	"match": 'match:eq',
 	"value": '2014-12-05',
@@ -808,29 +808,29 @@
   });
 
   var nestedGroupFactory = buildFactory(KorAP.VirtualCollection, {
-    "@type" : "korap:docGroup",
+    "@type" : "koral:docGroup",
     "operation" : "operation:or",
     "operands" : [
       {
-	"@type": 'korap:doc',
+	"@type": 'koral:doc',
 	"key" : 'author',
 	"match": 'match:eq',
 	"value": 'Max Birkendale',
 	"type": 'type:string'
       },
       {
-	"@type" : "korap:docGroup",
+	"@type" : "koral:docGroup",
 	"operation" : "operation:and",
 	"operands" : [
 	  {
-	    "@type": 'korap:doc',
+	    "@type": 'koral:doc',
 	    "key": 'pubDate',
 	    "match": 'match:geq',
 	    "value": '2014-05-12',
 	    "type": 'type:date'
 	  },
 	  {
-	    "@type": 'korap:doc',
+	    "@type": 'koral:doc',
 	    "key": 'pubDate',
 	    "match": 'match:leq',
 	    "value": '2014-12-05',
@@ -842,25 +842,25 @@
   });
 
   var flatGroupFactory = buildFactory(KorAP.VirtualCollection, {
-    "@type" : "korap:docGroup",
+    "@type" : "koral:docGroup",
     "operation" : "operation:and",
     "operands" : [
       {
-	"@type": 'korap:doc',
+	"@type": 'koral:doc',
 	"key": 'pubDate',
 	"match": 'match:geq',
 	"value": '2014-05-12',
 	"type": 'type:date'
       },
       {
-	"@type": 'korap:doc',
+	"@type": 'koral:doc',
 	"key": 'pubDate',
 	"match": 'match:leq',
 	"value": '2014-12-05',
 	"type": 'type:date'
       },
       {
-	"@type": 'korap:doc',
+	"@type": 'koral:doc',
 	"key": 'foo',
 	"match": 'match:eq',
 	"value": 'bar',
@@ -880,7 +880,7 @@
 
   it('should be based on a doc', function () {
     var vc = KorAP.VirtualCollection.render({
-      "@type" : "korap:doc",
+      "@type" : "koral:doc",
       "key":"Titel",
       "value":"Baum",
       "match":"match:eq"
@@ -1115,37 +1115,37 @@
 
   it('should flatten on import', function () {
     var vc = KorAP.VirtualCollection.create().render({
-      "@type":"korap:docGroup",
+      "@type":"koral:docGroup",
       "operation":"operation:or",
       "operands":[
 	{
-	  "@type":"korap:docGroup",
+	  "@type":"koral:docGroup",
 	  "operation":"operation:or",
 	  "operands":[
             {
-              "@type":"korap:doc",
+              "@type":"koral:doc",
               "key":"Titel",
               "value":"Baum",
               "match":"match:eq"
             },
             {
-              "@type":"korap:doc",
+              "@type":"koral:doc",
               "key":"Veröffentlichungsort",
               "value":"hihi",
               "match":"match:eq"
             },
             {
-              "@type":"korap:docGroup",
+              "@type":"koral:docGroup",
               "operation":"operation:or",
               "operands":[
 		{
-		  "@type":"korap:doc",
+		  "@type":"koral:doc",
 		  "key":"Titel",
 		  "value":"Baum",
 		  "match":"match:eq"
 		},
 		{
-		  "@type":"korap:doc",
+		  "@type":"koral:doc",
 		  "key":"Veröffentlichungsort",
 		  "value":"hihi",
 		  "match":"match:eq"
@@ -1155,7 +1155,7 @@
 	  ]
 	},
 	{
-	  "@type":"korap:doc",
+	  "@type":"koral:doc",
 	  "key":"Untertitel",
 	  "value":"huhu",
 	  "match":"match:eq"
@@ -1211,27 +1211,27 @@
 
 describe('KorAP._delete (event)', function () {
   var complexVCFactory = buildFactory(KorAP.VirtualCollection,{
-    "@type": 'korap:docGroup',
+    "@type": 'koral:docGroup',
     'operation' : 'operation:and',
     'operands' : [
       {
-	"@type": 'korap:doc',
+	"@type": 'koral:doc',
 	"key": 'pubDate',
 	"match": 'match:eq',
 	"value": '2014-12-05',
 	"type": 'type:date'
       },
       {
-	"@type" : 'korap:docGroup',
+	"@type" : 'koral:docGroup',
 	'operation' : 'operation:or',
 	'operands' : [
 	  {
-	    '@type' : 'korap:doc',
+	    '@type' : 'koral:doc',
 	    'key' : 'title',
 	    'value' : 'Hello World!'
 	  },
 	  {
-	    '@type' : 'korap:doc',
+	    '@type' : 'koral:doc',
 	    'key' : 'foo',
 	    'value' : 'bar'
 	  }
@@ -1242,7 +1242,7 @@
 
   it('should clean on root docs', function () {
     var vc = KorAP.VirtualCollection.render({
-      "@type": 'korap:doc',
+      "@type": 'koral:doc',
       "key": 'pubDate',
       "match": 'match:eq',
       "value": '2014-12-05',
@@ -1261,18 +1261,18 @@
   it ('should remove on nested docs', function () {
     var vc = KorAP.VirtualCollection.render(
       {
-	"@type": 'korap:docGroup',
+	"@type": 'koral:docGroup',
 	'operation' : 'operation:and',
 	'operands' : [
 	  {
-	    "@type": 'korap:doc',
+	    "@type": 'koral:doc',
 	    "key": 'pubDate',
 	    "match": 'match:eq',
 	    "value": '2014-12-05',
 	    "type": 'type:date'
 	  },
 	  {
-	    "@type" : 'korap:doc',
+	    "@type" : 'koral:doc',
 	    'key' : 'foo',
 	    'value' : 'bar'
 	  }
@@ -1291,18 +1291,18 @@
   it ('should clean on doc groups', function () {
     var vc = KorAP.VirtualCollection.render(
       {
-	"@type": 'korap:docGroup',
+	"@type": 'koral:docGroup',
 	'operation' : 'operation:and',
 	'operands' : [
 	  {
-	    "@type": 'korap:doc',
+	    "@type": 'koral:doc',
 	    "key": 'pubDate',
 	    "match": 'match:eq',
 	    "value": '2014-12-05',
 	    "type": 'type:date'
 	  },
 	  {
-	    "@type" : 'korap:doc',
+	    "@type" : 'koral:doc',
 	    'key' : 'foo',
 	    'value' : 'bar'
 	  }
@@ -1364,43 +1364,43 @@
   it ('should remove on nested doc groups (list flattening)', function () {
     var vc = KorAP.VirtualCollection.render(
       {
-	"@type": 'korap:docGroup',
+	"@type": 'koral:docGroup',
 	'operation' : 'operation:or',
 	'operands' : [
 	  {
-	    "@type": 'korap:doc',
+	    "@type": 'koral:doc',
 	    "key": 'pubDate',
 	    "match": 'match:eq',
 	    "value": '2014-12-05',
 	    "type": 'type:date'
 	  },
 	  {
-	    "@type" : 'korap:doc',
+	    "@type" : 'koral:doc',
 	    'key' : 'foo',
 	    'value' : 'bar'
 	  },
 	  {
-	    "@type": 'korap:docGroup',
+	    "@type": 'koral:docGroup',
 	    'operation' : 'operation:and',
 	    'operands' : [
 	      {
-		"@type": 'korap:doc',
+		"@type": 'koral:doc',
 		"key": 'pubDate',
 		"match": 'match:eq',
 		"value": '2014-12-05',
 		"type": 'type:date'
 	      },
 	      {
-		"@type" : 'korap:docGroup',
+		"@type" : 'koral:docGroup',
 		'operation' : 'operation:or',
 		'operands' : [
 		  {
-		    '@type' : 'korap:doc',
+		    '@type' : 'koral:doc',
 		    'key' : 'title',
 		    'value' : 'Hello World!'
 		  },
 		  {
-		    '@type' : 'korap:doc',
+		    '@type' : 'koral:doc',
 		    'key' : 'yeah',
 		    'value' : 'juhu'
 		  }
@@ -1443,27 +1443,27 @@
 
 describe('KorAP._add (event)', function () {
   var complexVCFactory = buildFactory(KorAP.VirtualCollection,{
-    "@type": 'korap:docGroup',
+    "@type": 'koral:docGroup',
     'operation' : 'operation:and',
     'operands' : [
       {
-	"@type": 'korap:doc',
+	"@type": 'koral:doc',
 	"key": 'pubDate',
 	"match": 'match:eq',
 	"value": '2014-12-05',
 	"type": 'type:date'
       },
       {
-	"@type" : 'korap:docGroup',
+	"@type" : 'koral:docGroup',
 	'operation' : 'operation:or',
 	'operands' : [
 	  {
-	    '@type' : 'korap:doc',
+	    '@type' : 'koral:doc',
 	    'key' : 'title',
 	    'value' : 'Hello World!'
 	  },
 	  {
-	    '@type' : 'korap:doc',
+	    '@type' : 'koral:doc',
 	    'key' : 'foo',
 	    'value' : 'bar'
 	  }
@@ -1475,18 +1475,18 @@
   it ('should add new unspecified doc with "and"', function () {
     var vc = KorAP.VirtualCollection.render(
       {
-	"@type": 'korap:docGroup',
+	"@type": 'koral:docGroup',
 	'operation' : 'operation:and',
 	'operands' : [
 	  {
-	    "@type": 'korap:doc',
+	    "@type": 'koral:doc',
 	    "key": 'pubDate',
 	    "match": 'match:eq',
 	    "value": '2014-12-05',
 	    "type": 'type:date'
 	  },
 	  {
-	    "@type" : 'korap:doc',
+	    "@type" : 'koral:doc',
 	    'key' : 'foo',
 	    'value' : 'bar'
 	  }
@@ -1520,18 +1520,18 @@
   it ('should add new unspecified doc with "or"', function () {
     var vc = KorAP.VirtualCollection.render(
       {
-	"@type": 'korap:docGroup',
+	"@type": 'koral:docGroup',
 	'operation' : 'operation:and',
 	'operands' : [
 	  {
-	    "@type": 'korap:doc',
+	    "@type": 'koral:doc',
 	    "key": 'pubDate',
 	    "match": 'match:eq',
 	    "value": '2014-12-05',
 	    "type": 'type:date'
 	  },
 	  {
-	    "@type" : 'korap:doc',
+	    "@type" : 'koral:doc',
 	    'key' : 'foo',
 	    'value' : 'bar'
 	  }
@@ -1710,18 +1710,18 @@
   it ('should wrap on root', function () {
     var vc = KorAP.VirtualCollection.render(
       {
-	"@type": 'korap:docGroup',
+	"@type": 'koral:docGroup',
 	'operation' : 'operation:and',
 	'operands' : [
 	  {
-	    "@type": 'korap:doc',
+	    "@type": 'koral:doc',
 	    "key": 'pubDate',
 	    "match": 'match:eq',
 	    "value": '2014-12-05',
 	    "type": 'type:date'
 	  },
 	  {
-	    "@type" : 'korap:doc',
+	    "@type" : 'koral:doc',
 	    'key' : 'foo',
 	    'value' : 'bar'
 	  }
@@ -1744,7 +1744,7 @@
   it ('should add on root (case "and")', function () {
     var vc = KorAP.VirtualCollection.render(
       {
-	"@type": 'korap:doc',
+	"@type": 'koral:doc',
 	"key": 'pubDate',
 	"match": 'match:eq',
 	"value": '2014-12-05',
@@ -1766,7 +1766,7 @@
   it ('should add on root (case "or")', function () {
     var vc = KorAP.VirtualCollection.render(
       {
-	"@type": 'korap:doc',
+	"@type": 'koral:doc',
 	"key": 'pubDate',
 	"match": 'match:eq',
 	"value": '2014-12-05',
@@ -1787,36 +1787,36 @@
   it ('should support multiple sub groups per group', function () {
     var vc = KorAP.VirtualCollection.render(
       {
-	"@type": 'korap:docGroup',
+	"@type": 'koral:docGroup',
 	'operation' : 'operation:or',
 	'operands' : [
 	  {
-	    "@type": 'korap:docGroup',
+	    "@type": 'koral:docGroup',
 	    'operation' : 'operation:and',
 	    'operands' : [
 	      {
-		"@type": 'korap:doc',
+		"@type": 'koral:doc',
 		"key": 'title',
 		"value": 't1',
 	      },
 	      {
-		"@type" : 'korap:doc',
+		"@type" : 'koral:doc',
 		'key' : 'title',
 		'value' : 't2'
 	      }
 	    ]
 	  },
 	  {
-	    "@type": 'korap:docGroup',
+	    "@type": 'koral:docGroup',
 	    'operation' : 'operation:and',
 	    'operands' : [
 	      {
-		"@type": 'korap:doc',
+		"@type": 'koral:doc',
 		"key": 'title',
 		"value": 't3',
 	      },
 	      {
-		"@type" : 'korap:doc',
+		"@type" : 'koral:doc',
 		'key' : 'title',
 		'value' : 't4'
 	      }
@@ -1844,7 +1844,7 @@
 
   it('should be initializable', function () {
     var rewrite = KorAP.Rewrite.create({
-      "@type" : "korap:rewrite",
+      "@type" : "koral:rewrite",
       "operation" : "operation:modification",
       "src" : "querySerializer",
       "scope" : "tree"
@@ -1855,7 +1855,7 @@
   it('should be deserialized by docs', function () {
     var doc = KorAP.Doc.create(undefined,
       {
-        "@type":"korap:doc",
+        "@type":"koral:doc",
         "key":"Titel",
         "value":"Baum",
         "match":"match:eq"
@@ -1866,13 +1866,13 @@
 
     doc = KorAP.Doc.create(undefined,
       {
-        "@type":"korap:doc",
+        "@type":"koral:doc",
         "key":"Titel",
         "value":"Baum",
         "match":"match:eq",
 	"rewrites" : [
 	  {
-	    "@type" : "korap:rewrite",
+	    "@type" : "koral:rewrite",
 	    "operation" : "operation:modification",
 	    "src" : "querySerializer",
 	    "scope" : "tree"
@@ -1888,3 +1888,11 @@
   });
 */
 });
+/*
+describe('KorAP.DocKey', function () {
+  it('should be initializable', function () {
+    var docKey = KorAP.DocKey.create();
+    expect(docKey.toString()).toEqual('...');
+  });
+});
+*/
diff --git a/public/js/src/menu.js b/public/js/src/menu.js
index b251000..f0dd15d 100644
--- a/public/js/src/menu.js
+++ b/public/js/src/menu.js
@@ -1,5 +1,11 @@
 var KorAP = KorAP || {};
 
+/**
+ * Create scrollable drop-down menus.
+ *
+ * @author Nils Diewald
+ */
+
 (function (KorAP) {
   "use strict";
 
@@ -25,39 +31,63 @@
       return Object.create(KorAP.Menu)._init(params);
     },
 
+    focus : function () {
+      this._element.focus();
+    },
+
+    // Initialize list
     _init : function (itemClass, params) {
       // this._element.addEventListener("click", chooseHint, false);
       this._itemClass = itemClass;
       this._element = document.createElement("ul");
       this._element.style.opacity = 0;
 
+/*
+      this._listener = document.createElement('input');
+      this._listener.setAttribute('type', 'text');
+//      this._listener.style.display = "none";
+*/
+      this._element.addEventListener(
+	"keydown",
+	function (e) {
+          console.log('+++');
+	},
+	false
+      );
+
       this.active = false;
       this._items = new Array();
       var i;
+
+      // Initialize item list based on parameters
       for (i in params) {
 	var obj = itemClass.create(params[i]);
-	this._items.push(
-	  obj
-	);
+	this._items.push(obj);
       };
       this._limit    = KorAP.menuLimit;
       this._position = 0;  // position in the active list
       this._active   = -1; // active item in the item list
-
       this._reset();
       return this;
     },
 
+    /**
+     * Get the instantiated HTML element
+     */
     element : function () {
       return this._element;
     },
 
+    /**
+     * Get the creator object for items
+     */
     itemClass : function () {
       return this._itemClass;
     },
 
     /**
-     * Get and set numerical value for limit
+     * Get and set numerical value for limit,
+     * i.e. the number of items visible.
      */
     limit : function (limit) {
       if (arguments.length === 1)
@@ -69,7 +99,7 @@
      * Upgrade this object to another object,
      * while private data stays intact.
      *
-     * @param {Object] An object with properties.
+     * @param {Object} An object with properties.
      */
     upgradeTo : function (props) {
       for (var prop in props) {
@@ -78,6 +108,7 @@
       return this;
     },
 
+    // Reset chosen item and prefix
     _reset : function () {
       this._offset = 0;
       this._pos    = 0;
@@ -96,30 +127,30 @@
       if (!this._initList())
 	return;
 
-      // show based on offset
+      // show based on initial offset
       this._showItems(0);
 
       // Set the first element to active
+      // Todo: Or the last element chosen
       this.liveItem(0).active(true);
 
       this._position = 0;
       this._active = this._list[0];
 
+      this._element.style.opacity = 1;
+
       // Add classes for rolling menus
       this._boundary(true);
     },
 
-    /**
-     * Get a specific item from the complete list
-     *
-     * @param {number} index of the list item
-     */
-    item : function (index) {
-      return this._items[index]
+    hide : function () {
+      this._element.style.opacity = 0;
     },
 
+    // Initialize the list
     _initList : function () {
 
+      // Create a new list
       if (this._list === undefined) {
 	this._list = [];
       }
@@ -131,20 +162,27 @@
       // Offset is initially zero
       this._offset = 0;
 
+      // There is no prefix set
       if (this.prefix().length <= 0) {
 	for (var i = 0; i < this._items.length; i++)
 	  this._list.push(i);
 	return true;
       };
 
+      // There is a prefix set, so filter the list
       var pos;
       var paddedPrefix = " " + this.prefix();
 
+      // Iterate over all items and choose preferred matching items
+      // i.e. the matching happens at the word start
       for (pos = 0; pos < this._items.length; pos++) {
 	if ((this.item(pos).lcField().indexOf(paddedPrefix)) >= 0)
 	  this._list.push(pos);
       };
 
+      // The list is empty - so lower your expectations
+      // Iterate over all items and choose matching items
+      // i.e. the matching happens anywhere in the word
       if (this._list.length == 0) {
 	for (pos = 0; pos < this._items.length; pos++) {
 	  if ((this.item(pos).lcField().indexOf(this.prefix())) >= 0)
@@ -152,7 +190,7 @@
 	};
       };
 
-      // Filter was successful
+      // Filter was successful - yeah!
       return this._list.length > 0 ? true : false;
     },
 
@@ -164,12 +202,13 @@
 
     /**
      * Get the prefix for filtering,
-     * e.g. &quot;ve"&quot; for &quot;verb&quot;
+     * e.g. &quot;ve&quot; for &quot;verb&quot;
      */
     prefix : function () {
       return this._prefix || '';
     },
 
+    // Append Items that should be shown
     _showItems : function (offset) {
       this.delete();
 
@@ -194,12 +233,16 @@
      */
     delete : function () {
       var child;
+
+      // Iterate over all visible items
       for (var i = 0; i <= this.limit(); i++) {
 
+	// there is a visible element - unhighlight!
 	if (child = this.shownItem(i))
 	  child.lowlight();
       };
 
+      // Remove all children
       while (child = this._element.firstChild)
 	this._element.removeChild(child);
     },
@@ -218,10 +261,38 @@
     },
 
 
+    // Prepend item to the shown list based on index
+    _prepend : function (i) {
+      var item = this.item(i);
+
+      // Highlight based on prefix
+      if (this.prefix().length > 0)
+	item.highlight(this.prefix());
+
+      var e = this.element();
+      // Append element
+      e.insertBefore(
+	item.element(),
+	e.firstChild
+      );
+    },
+
+
+    /**
+     * Get a specific item from the complete list
+     *
+     * @param {number} index of the list item
+     */
+    item : function (index) {
+      return this._items[index]
+    },
+
+
     /**
      * Get a specific item from the filtered list
      *
      * @param {number} index of the list item
+     *        in the filtered list
      */
     liveItem : function (index) {
       if (this._list === undefined)
@@ -231,15 +302,12 @@
       return this._items[this._list[index]];
     },
 
-    length : function () {
-      return this._items.length;
-    },
-
 
     /**
      * Get a specific item from the visible list
      *
      * @param {number} index of the list item
+     *        in the visible list
      */
     shownItem : function (index) {
       if (index >= this.limit())
@@ -248,8 +316,16 @@
     },
 
 
-    /*
-     * Make the next item in the menu active
+    /**
+     * Get the length of the full list
+     */
+    length : function () {
+      return this._items.length;
+    },
+
+
+    /**
+     * Make the next item in the filtered menu active
      */
     next : function () {
       // No active element set
@@ -270,7 +346,7 @@
       }
 
       // The next element is outside the view - roll down
-      else if (this._position >= (this.limit + this._offset)) {
+      else if (this._position >= (this.limit() + this._offset)) {
 	this._removeFirst();
 	this._offset++;
 	this._append(this._list[this._position]);
@@ -282,8 +358,8 @@
     /*
      * Make the previous item in the menu active
      */
-/*
     prev : function () {
+      // No active element set
       if (this._position == -1)
 	return;
 
@@ -294,9 +370,9 @@
 
       // The previous element is undefined - roll to bottom
       if (newItem === undefined) {
-	this._position = this.liveLength - 1;
+	this._offset = this.liveLength() - this.limit();
+	this._position = this.liveLength() - 1;
 	newItem = this.liveItem(this._position);
-	this._offset = this.liveLength - this.limit;
 	this._showItems(this._offset);
       }
 
@@ -306,85 +382,33 @@
 	this._offset--;
 	this._prepend(this._list[this._position]);
       };
+
       newItem.active(true);
     },
-*/
 
 
-    /**
-     * Get the context of the menue,
-     * e.g. &quot;tt/&quot; for the tree tagger menu
-     */
-/*
-    get context () {
-      return this._context;
-    },
-*/
-/*
-    get liveLength () {
-      if (this._list === undefined)
-	this._initList();
-      return this._list.length;
-    },
-*/
-/*
-    chooseHint : function (e) {
-      var element = e.target;
-      while (element.nodeName == "STRONG" || element.nodeName == "SPAN")
-	element = element.parentNode;
-
-      if (element === undefined || element.nodeName != "LI")
-	return;
-
-      var action = element.getAttribute('data-action');
-      hint.insertText(action);
-      var menu = hint.menu();
-      menu.hide();
-
-      // Fill this with the correct value
-      var show;
-      if ((show = hint.analyzeContext()) != "-") {
-	menu.show(show);
-	menu.update(
-	  hint._search.getBoundingClientRect().right
-	);
-      };
-
-      hint._search.focus();
-    },
-
+    // Remove the HTML node from the first item
     _removeFirst : function () {
       this.item(this._list[this._offset]).lowlight();
       this._element.removeChild(this._element.firstChild);
     },
 
+
+    // Remove the HTML node from the last item
     _removeLast : function () {
-      this.item(this._list[this._offset + this.limit - 1]).lowlight();
+      this.item(this._list[this._offset + this.limit() - 1]).lowlight();
       this._element.removeChild(this._element.lastChild);
     },
 
-
-    // Prepend item to the shown list based on index
-    _prepend : function (i) {
-      var item = this.item(i);
-
-      // Highlight based on prefix
-      if (this.prefix.length > 0)
-	item.highlight(this.prefix);
-
-      // Append element
-      this.element.insertBefore(
-	item.element,
-	this.element.firstChild
-      );
-    },
-*/
-
+    // Length of the filtered list
+    liveLength : function () {
+      if (this._list === undefined)
+	this._initList();
+      return this._list.length;
+    }
   };
 
 
-
-
   /**
    * Item in the Dropdown menu
    */
@@ -585,4 +609,10 @@
     },
   };
 
+/*
+  KorAP._updateKey : function (e) {
+    var code = this._codeFromEvent(e)    
+  };
+*/
+
 }(this.KorAP));
diff --git a/public/js/src/vc.js b/public/js/src/vc.js
index d226fc4..00528aa 100644
--- a/public/js/src/vc.js
+++ b/public/js/src/vc.js
@@ -3,9 +3,13 @@
  *
  * @author Nils Diewald
  */
-
+/*
+ * Replaces a previous version written by Mengfei Zhou
+ */
 var KorAP = KorAP || {};
 
+// Requires menu.js
+
 /*
   TODO: Implement a working localization solution!
   TODO: Disable "and" or "or" in case it's followed
@@ -50,7 +54,6 @@
   loc.DEL   = loc.DEL   || '×';
   loc.EMPTY = loc.EMPTY || '⋯'
 
-
   // Utility for analysing boolean values
   function _bool (bool) {
     return (bool === undefined || bool === null || bool === false) ? false : true;
@@ -148,10 +151,10 @@
 
       if (json !== undefined) {
 	// Root object
-	if (json['@type'] == 'korap:doc') {
+	if (json['@type'] == 'koral:doc') {
 	  obj._root = KorAP.Doc.create(obj, json);
 	}
-	else if (json['@type'] == 'korap:docGroup') {
+	else if (json['@type'] == 'koral:docGroup') {
 	  obj._root = KorAP.DocGroup.create(obj, json);
 	}
 	else {
@@ -343,7 +346,7 @@
 
       // Set JSON-LD type
       var newDoc = KorAP.Doc.create(this._parent, {
-	"@type" : "korap:doc",
+	"@type" : "koral:doc",
 	"value" : "",
 	"key"   : v
       });
@@ -374,6 +377,9 @@
       ellipsis.appendChild(document.createTextNode(loc.EMPTY));
       this._element.appendChild(ellipsis);
 
+      // Set ref - TODO: Cleanup!
+      this._element.refTo = this;
+
       // Set operators
       if (this._parent !== undefined && this.parent().ldType() !== null) {
 	var op = this.operators(
@@ -430,6 +436,9 @@
       // Get element
       var e = this._element;
 
+      // Set ref - TODO: Cleanup!
+      e.refTo = this;
+
       // Check if there is a change
       if (this.__changed) {
 
@@ -441,6 +450,10 @@
 	// Added key
 	var key = document.createElement('span');
 	key.setAttribute('class', 'key');
+
+	// Change key
+	key.addEventListener('click', KorAP._changeKey, false);
+
 	if (this.key())
 	  key.appendChild(document.createTextNode(this.key()));
 
@@ -676,7 +689,7 @@
 	return {};
       
       return {
-	"@type" : "korap:" + this.ldType(),
+	"@type" : "koral:" + this.ldType(),
 	"key"   : this.key(),
 	"match" : "match:" + this.matchop(),
 	"value" : this.value() || '',
@@ -810,7 +823,7 @@
 	KorAP.log(701, "JSON-LD group has no @type attribute");
 	return;
 
-      case "korap:doc":
+      case "koral:doc":
 	// Be aware of cyclic structures!
 	var doc = KorAP.Doc.create(this, operand);
 	if (doc === undefined)
@@ -822,7 +835,7 @@
 	};
 	return dupl;
 
-      case "korap:docGroup":
+      case "koral:docGroup":
 	// Be aware of cyclic structures!
 	var docGroup = KorAP.DocGroup.create(this, operand);
 	if (docGroup === undefined)
@@ -1039,7 +1052,7 @@
 	  opArray.push(this._operands[i].toJson());
       };
       return {
-	"@type"     : "korap:" + this.ldType(),
+	"@type"     : "koral:" + this.ldType(),
 	"operation" : "operation:" + this.operation(),
 	"operands"  : opArray
       };
@@ -1301,7 +1314,7 @@
     toJson : function () {
       return {
 	// Unspecified object
-	"@type" : "korap:" + this.ldType()
+	"@type" : "koral:" + this.ldType()
       };
     },
 
@@ -1309,5 +1322,65 @@
       return '';
     }
   };
+
+
+  /**
+   * Criterion in a KorAP.Doc
+   */
+  KorAP._changeKey = function () {
+    var doc = this.parentNode.refTo;
+    console.log(doc.type());
+    // key, matchop, type, value
+  };
+  
+
+  // Field menu
+  KorAP.FieldMenu = {
+    create : function (params) {
+      return Object.create(KorAP.Menu)
+	.upgradeTo(KorAP.FieldMenu)
+	._init(KorAP.FieldMenuItem, params)
+    }
+  };
+
+
+  // Field menu item
+  KorAP.FieldMenuItem = {
+    create : function (params) {
+      return Object.create(KorAP.MenuItem)
+	.upgradeTo(KorAP.FieldMenuItem)
+	._init(params);
+    },
+    _init : function (params) {
+      if (params[0] === undefined)
+	throw new Error("Missing parameters");
+
+      this._name  = params[0];
+      this._value = params[1];
+      this._type  = params[2];
+
+      this._lcField = ' ' + this._name.toLowerCase();
+
+      return this;
+    },
+    name : function () {
+      return this._name;
+    },
+    type : function () {
+      return this._type;
+    },
+    element : function () {
+      // already defined
+      if (this._element !== undefined)
+	return this._element;
+
+      // Create list item
+      var li = document.createElement("li");
+      li.setAttribute("data-type", this._type);
+      li.setAttribute("data-value", this._value);
+      li.appendChild(document.createTextNode(this._name));
+      return this._element = li;
+    }
+  };
  
 }(this.KorAP));
