diff --git a/dev/js/src/hint/foundries.js b/dev/js/src/hint/foundries.js
index 6f2ac02..67a6a88 100644
--- a/dev/js/src/hint/foundries.js
+++ b/dev/js/src/hint/foundries.js
@@ -1,3 +1,81 @@
+window.KorAP = window.KorAP || {};
+KorAP.annotationHelper = KorAP.annotationHelper || { '-' : [] };
+
 define(function () {
-  return (KorAP.annotationHelper = KorAP.annotationHelper || { '-' : [] });
+
+  var ah = KorAP.annotationHelper;
+
+  ah["getDesc"] = function (foundryLayer, value) {
+
+    if (!foundryLayer)
+      return;
+
+    var anno = this[foundryLayer];
+
+    if (!anno)
+      return;
+
+    if (value.indexOf(':') < 0) {
+      value += ' ';
+
+      // Iterate over all annotations and add the descriptions
+      // This is a classic hash-lookup-case, but we have
+      // to deal with lists ...
+      for (var i = 0; i < anno.length; i++) {
+        if (anno[i] &&
+            anno[i][1] == value) {
+          if (anno[i][2])
+            return anno[i][2];
+          else
+            return;
+        };
+      };
+
+      return;
+    }
+    else {
+      var text = '';
+      var v = value.split(":");
+      var l1 = v[0];
+      var l2 = v[1];
+
+      l1 += ':';
+
+      // Add key description
+      for (var i = 0; i < anno.length; i++) {
+        if (anno[i] &&
+            anno[i][1] == l1) {
+          if (anno[i][2])
+            text += anno[i][2];
+          else
+            text += anno[i][0];
+          break;
+        };
+      };
+
+      // Nothinmg found
+      if (text.length === 0)
+        return;
+
+      // Check next level
+      anno = this[foundryLayer + l1];
+
+      l2 += ' ';
+
+      // Add value description
+      for (var i = 0; i < anno.length; i++) {
+        if (anno[i] &&
+            anno[i][1] == l2) {
+          if (anno[i][2])
+            text += ': ' + anno[i][2];
+
+          return text;
+        };
+      };      
+    };
+
+    return '';
+  };
+
+  return ah;
 });
diff --git a/dev/js/src/hint/foundries/cnx.js b/dev/js/src/hint/foundries/cnx.js
index 608d4e6..9316cbd 100644
--- a/dev/js/src/hint/foundries/cnx.js
+++ b/dev/js/src/hint/foundries/cnx.js
@@ -58,6 +58,6 @@
     ["@NH", "@NH ", "Nominal Head"],
     ["@POSTMOD", "@POSTMOD ", "Postmodifier"],
     ["@PREMARK", "@PREMARK ", "Preposed Marker"],
-    ["@PREMOD", "@POSTMOD ", "Premodifier"]
+    ["@PREMOD", "@PREMOD ", "Premodifier"]
   ];
 });
diff --git a/dev/js/src/match/table.js b/dev/js/src/match/table.js
index 481e60a..a8ae51d 100644
--- a/dev/js/src/match/table.js
+++ b/dev/js/src/match/table.js
@@ -155,24 +155,41 @@
       var tr = table.appendChild(d.createElement('thead'))
           .appendChild(d.createElement('tr'));
 
+      var ah = KorAP.annotationHelper || { "getDesc" : function () {}};
+
       // Add cell to row
-      var addCell = function (type, name) {
+      var addCell = function (type, key, value) {        
         var c = this.appendChild(d.createElement(type))
-        if (name === undefined)
+        if (value === undefined)
           return c;
 
-        if (name instanceof Array && name[1] !== undefined) {
+        if (key && value instanceof Array && value[1] !== undefined) {
 
           // There are multiple values to add
           c.classList.add('matchkeyvalues');
-          for (var n = 0; n < name.length; n++) {
-            var text = d.createTextNode(name[n]);
+          for (var n = 0; n < value.length; n++) {
+            var text = d.createTextNode(value[n]);
             var e = c.appendChild(d.createElement('div'));
             e.appendChild(text);
+
+            var anno = ah.getDesc(key, value[n]);
+
+            if (anno)
+              e.setAttribute("title", anno);
           };
         }
+
         else {
-          c.appendChild(d.createTextNode(name));
+
+          if (value instanceof Array)
+            value = value[0];
+
+          c.appendChild(d.createTextNode(value));
+
+          // Add tooltip
+          var anno = ah.getDesc(key, value);
+          if (anno)
+            c.setAttribute("title", anno);
         };
 
         return c;
@@ -181,12 +198,12 @@
       tr.addCell = addCell;
 
       // Add header information
-      tr.addCell('th', 'Foundry');
-      tr.addCell('th', 'Layer');
+      tr.addCell('th', undefined, 'Foundry');
+      tr.addCell('th', undefined, 'Layer');
 
       // Add tokens
       for (var i in this._token) {
-        tr.addCell('th', this.getToken(i));
+        tr.addCell('th', undefined, this.getToken(i));
       };
       
       var tbody = table.appendChild(
@@ -195,8 +212,6 @@
 
       var foundryList = Object.keys(this._foundry).sort();
 
-      var ah = KorAP.annotationHelper || {};
-
       for (var f = 0; f < foundryList.length; f++) {
         var foundry = foundryList[f];
         var layerList =
@@ -210,11 +225,10 @@
           tr.setAttribute('tabindex', 0);
           tr.addCell = addCell;
 
-          tr.addCell('th', foundry);
-          tr.addCell('th', layer);
+          tr.addCell('th', undefined, foundry);
+          tr.addCell('th', undefined, layer);
 
           var key = foundry + '/' + layer + '=';
-          var anno = ah[key];
 
           for (var v = 0; v < this.length(); v++) {
 
@@ -224,24 +238,9 @@
             // Add cell to row
             var cell = tr.addCell(
               'td',
+              key,
               value 
             );
-
-            // Iterate over all annotations and add the descriptions
-            if (anno) {
-
-              // This is a classic hash-lookup-case, but we have
-              // to deal with lists ...
-              for (var i = 0; i < anno.length; i++) {
-                if (anno[i] &&
-                    anno[i][0] &&
-                    anno[i][2] &&
-                    anno[i][0] == value) {
-                  cell.setAttribute('title', anno[i][2]);
-                  break;
-                };
-              };
-            };
           };
         };
       };
