diff --git a/dev/js/src/api.js b/dev/js/src/api.js
index 89534be..b87eb1f 100644
--- a/dev/js/src/api.js
+++ b/dev/js/src/api.js
@@ -57,6 +57,25 @@
 
 
   /**
+   * Retrieve information about a document.
+   */
+  KorAP.API.getTextInfo = function (doc, param, cb) {
+
+    // doc is a KorAP.Match object
+    var url = KorAP.URL;
+    url += '/' + match.textSigle;
+
+    if (param['fields'] !== undefined) {
+      url += '?fields='; // TODO!
+    }
+    else {
+      url += '?fields=@all';
+    }
+    KorAP.API.getJSON(url, cb);
+  };
+
+
+  /**
    * Retrieve information about collections
    */
   KorAP.API.getCollections = function (cb) {
diff --git a/dev/js/src/match.js b/dev/js/src/match.js
index 63fa55a..bca7f09 100644
--- a/dev/js/src/match.js
+++ b/dev/js/src/match.js
@@ -190,19 +190,23 @@
       
       var ops = d.createElement('div');
       ops.classList.add('action', 'bottom', 'button-group');
-      
+
+      /*
+        Temporarily disabled
       var meta = ops.addE('span');
       meta.addT('Meta');
       meta.setAttribute('title', loc.SHOW_META);
       meta.classList.add('meta');
+      */
 
+      // TODO: Rename anno
       var info = ops.addE('span');
-      info.addT('Anno');
+      info.addT(loc.SHOWINFO);
       info.setAttribute('title', loc.SHOWINFO);
       info.classList.add('info');
 
       var tree = ops.addE('span');
-      tree.addT('+ Tree');
+      tree.addT(loc.ADDTREE);
       tree.setAttribute('title', loc.ADDTREE);
       tree.classList.add('tree');
 
@@ -213,12 +217,14 @@
       );
 
       // Click on meta - add meta (unless already there)
+      /*
       meta.addEventListener(
         'click', function (e) {
           e.halt();
           that.info().showMeta();
         }
       );
+      */
 
       // Click on token annotations - add token annotations (unless already there)
       info.addEventListener(
diff --git a/dev/js/src/match/info.js b/dev/js/src/match/info.js
index a72b66f..ba7214e 100644
--- a/dev/js/src/match/info.js
+++ b/dev/js/src/match/info.js
@@ -141,8 +141,35 @@
     },
 
 
-    getMetaData : function (metaInfo, cb) {
-      // ...
+    getMetaData : function (cb) {
+      KorAP.API.getTextInfo(
+        this._match, {}, function (textResponse) {
+          
+          if (textResponse === undefined) {
+            cb(null);
+            return;
+          };
+
+          var doc = textResponse["document"];
+       
+
+          if (doc === undefined) {
+            cb(null);
+            return;
+          };
+
+          var fields = doc["fields"];
+          if (fields === undefined) {
+            cb(null);
+            return;
+          };
+
+          // Add metainfo to matchview
+          cb(matchMetaClass.create(
+            this._match, fields
+          ));
+        }
+      );
     },
     
 
@@ -160,6 +187,11 @@
           'layer' : layer
         },
         function (matchResponse) {
+          if (matchResponse === undefined) {
+            cb(null);
+            return;
+          };
+
           // Get snippet from match info
           if (matchResponse["snippet"] !== undefined) {
             // Todo: This should be cached somehow
@@ -284,33 +316,29 @@
       metaTable.classList.add('metatable', 'loading');
       this.element().appendChild(metaTable);
 
-      // TODO: This is part of the getMeta!
+      /*
+       * This was temporary
       var metaInfo = this._match.element().getAttribute('data-info');
-
       if (metaInfo)
         metaInfo = JSON.parse(metaInfo);
-
+      */
       var that = this;
 
-      // There is metainfo
-      if (metaInfo) {
-
+      this.getMetaData(function (meta) {
         // Load data
         metaTable.classList.remove('loading');
 
-        // Add metainfo to matchview
-        var metaElem = matchMetaClass.create(this._match).element(metaInfo);
-        metaTable.appendChild(metaElem);
+        metaTable.appendChild(meta.element());
 
         // Add button
-        this._addButton('close', metaTable, function (e) {
+        that._addButton('close', metaTable, function (e) {
           this.parentNode.removeChild(this);
           that._visibleMeta = false;
           e.halt();
         });
-      };
+      });
 
-      // Load data
+      // Do not load any longer
       metaTable.classList.remove('loading');
     },
 
diff --git a/dev/js/src/match/meta.js b/dev/js/src/match/meta.js
index 8237935..05e1f3b 100644
--- a/dev/js/src/match/meta.js
+++ b/dev/js/src/match/meta.js
@@ -27,23 +27,24 @@
 
   // Localization values
   const loc   = KorAP.Locale;
-  loc.METADATA   = loc.METADATA   || 'Metadata';
+  loc.METADATA = loc.METADATA || 'Metadata';
 
   return {
 
     /**
      * Create new match object
      */
-    create : function (match) {
-      return Object.create(this)._init(match);
+    create : function (match, fields) {
+      return Object.create(this)._init(match, fields);
     },
 
     /**
      * Initialize object
      */
-    _init : function (match) {
+    _init : function (match, fields) {
       this._match = match;
-      this.opened = false;
+      this._fields = fields;
+      // this.opened = false;
       return this;
     },
 
@@ -57,26 +58,35 @@
     /**
      * Create match reference view.
      */
-    element : function (metaInfo) {
+    element : function () {
       if (this._element !== undefined)
         return this._element;
-      
-      /*
-      var header = metaTable.appendChild(
-        document.createElement('h6')
-      );
 
-      header.appendChild(
-        document.createElement('div')
-      ).appendChild(
-        document.createTextNode(loc.METADATA)
-      );
-      */
+      if (this._fields === null)
+        return;
 
       var metaDL = document.createElement('dl');
 
       this._element = metaDL;
 
+      var fields = this._fields;
+
+      // TODO:
+      // This should only remember array positions by index
+      // and keep all other field information intact
+      var metaInfo = {};
+      for (var i in fields) {
+        var value = fields[i].value;
+        if (value instanceof Array) {
+          metaInfo[fields[i].key] = value.join(", ");
+        }
+        else {
+          metaInfo[fields[i].key] = value;
+        };
+      };
+
+      // console.log(fields);
+
       // TODO: Meta fields should be separated
       var keys = Object.keys(metaInfo);
       for (var i in keys.sort()) {
