diff --git a/dev/js/src/match.js b/dev/js/src/match.js
index 3827af1..e70d975 100644
--- a/dev/js/src/match.js
+++ b/dev/js/src/match.js
@@ -178,113 +178,79 @@
       close.classList.add('close');
       close.setAttribute('title', loc.CLOSE);
       
-      // Add info button
-      /*
-      var info = document.createElement('li');
-      info.appendChild(document.createElement('span'))
-        .appendChild(document.createTextNode(loc.SHOWINFO));
-      info.classList.add('info');
-      info.setAttribute('title', loc.SHOWINFO);
-      */
-
       var that = this;
 
       // Add meta button
       var refLine = element.querySelector("p.ref");
 
-      // There is a reference line
-      if (refLine) {
+      if (!refLine)
+        return;
+      
+      // TODO: Simplify
+      var ops = document.createElement('div');
+      ops.classList.add('action', 'bottom', 'button-group');
+      
+      var meta = document.createElement('span');
+      ops.appendChild(meta);
+      meta.appendChild(document.createTextNode('Meta'));
+      meta.setAttribute('title', loc.SHOW_META);
+      meta.classList.add('meta');
 
-        // Temporary
-        var ops = document.createElement('div');
-        ops.classList.add('action', 'bottom', 'button-group');
+      var info = document.createElement('span');
+      ops.appendChild(info);
+      info.appendChild(document.createTextNode('Anno'));
+      info.setAttribute('title', loc.SHOWINFO);
+      info.classList.add('info');
 
-        var meta = document.createElement('span');
-        ops.appendChild(meta);
-        meta.appendChild(document.createTextNode('+ Meta'));
-        meta.setAttribute('title', loc.SHOW_META);
-        meta.classList.add('meta');
+      var tree = document.createElement('span');
+      ops.appendChild(tree);
+      tree.appendChild(document.createTextNode('+ Tree'));
+      tree.setAttribute('title', loc.ADDTREE);
+      tree.classList.add('tree');
 
-        var info = document.createElement('span');
-        ops.appendChild(info);
-        info.appendChild(document.createTextNode('+ Anno'));
-        info.setAttribute('title', loc.SHOWINFO);
-        info.classList.add('info');
+      // Insert before reference line
+      refLine.insertBefore(
+        ops,
+        refLine.firstChild
+      );
 
-        var tree = document.createElement('span');
-        ops.appendChild(tree);
-        tree.appendChild(document.createTextNode('+ Tree'));
-        tree.setAttribute('title', loc.ADDTREE);
-        tree.classList.add('tree');
-        
-        refLine.insertBefore(
-          ops,
-          refLine.firstChild
-        );
+      // Click on meta - add meta (unless already there)
+      meta.addEventListener(
+        'click', function (e) {
+          e.halt();
+          that.info().showMeta();
+        }
+      );
 
-        /*
-        var meta = document.createElement('span');
-        meta.appendChild(
-          document.createElement('span')
-        ).appendChild(
-          document.createTextNode(loc.SHOW_META)
-        );
-        meta.setAttribute('title', loc.SHOW_META);
-        meta.classList.add('meta');
-        refLine.insertBefore(
-          meta,
-          refLine.firstChild
-        );
-        */
+      // Click on token annotations - add token annotations (unless already there)
+      info.addEventListener(
+        'click', function (e) {
+          e.halt();
+          that.info().showTable();
+        }
+      );
 
-        meta.addEventListener(
-          'click', function (e) {
-            e.halt();
-            that.info().addMeta();
-          }
-        );
+      // Click to show tree menu
+      tree.addEventListener(
+        'click', function (e) {
+          e.halt();
 
-        // Add information, unless it already exists
-        info.addEventListener(
-          'click', function (e) {
-            e.halt();
-            that.info().addTable();
-          }
-        );
+          if (KorAP.TreeMenu === undefined) {
+            KorAP.TreeMenu = matchTreeMenuClass.create([]);
+          };
 
-        tree.addEventListener(
-          'click', function (e) {
-            e.halt();
+          var tm = KorAP.TreeMenu;
 
-            if (KorAP.TreeMenu === undefined) {
-              KorAP.TreeMenu = matchTreeMenuClass.create([]);
-            };
+          // Reread list
+          tm.info(that.info());
+          tm.readItems(that.treeMenuList());
 
-            var tm = KorAP.TreeMenu;
-
-            // Reread list
-            tm.info(that.info());
-            tm.readItems(that.treeMenuList());
-            tm.attachTo(this);
-
-            // Not yet initialized
-            /*
-              if (that._treemenu === undefined) {
-              that._treemenu = that.initTreeMenu();
-
-              // TODO:
-              // Do not add the tree menu to the button!
-              // Only reposition a global treemenu element there,
-              // that is positioned below the annotation helper!
-              this.appendChild(that._treemenu.element());
-            };
-            var tm = that._treemenu;
-            */
-            tm.show();
-            tm.focus();
-          }
-        );
-      };
+          // Reposition and show menu
+          tm.attachTo(this);
+          tm.show();
+          tm.focus();
+        }
+      );
 
       // Close match
       close.addEventListener('click', function (e) {
@@ -292,16 +258,7 @@
         that.close()
       });
 
-      // Add information, unless it already exists
-      /*
-      info.addEventListener('click', function (e) {
-        e.halt();
-        that.info().addTable();
-      });
-      */
-
       ul.appendChild(close);
-      // ul.appendChild(info);
 
       return true;
     },
@@ -321,15 +278,16 @@
      */
     close : function () {
       this._element.classList.remove('active');
-      /* if (this._info !== undefined) {
-       *   this._info.destroy();
-       * };
-       */
+      /*
+      if (this._info !== undefined) {
+        this._info.destroy();
+      };
+      */
     },
 
 
     /**
-     * Get and open associated match info.
+     * Get and open associated match infos.
      */
     info : function () {
 
@@ -346,11 +304,6 @@
       if (this._info._element !== undefined)
         return this._info;
 
-      /*
-        this.element().appendChild(
-        this._info.element()
-      );
-      */
       var refLine = this._element.querySelector("p.ref");
       this._element.insertBefore(
         this._info.element(),
@@ -361,6 +314,7 @@
     },
 
 
+    // Return tree menu list
     treeMenuList : function () {
 
       if (this._menuList)
@@ -414,34 +368,8 @@
       // Create tree menu
       this._menuList = menuList;
       return menuList;
-      /*
-      var span = document.createElement('p');
-      span.classList.add('addtree');
-      span.appendChild(document.createTextNode(loc.ADDTREE));
-      var treeElement = treemenu.element();
-      span.appendChild(treeElement);
-
-      span.addEventListener('click', function (e) {
-        treemenu.show();
-        treemenu.focus();
-      });
-      */
     },
 
-        
-    /**
-     * Get tree menu.
-     * There is only one menu rendered
-     * - no matter how many trees exist
-     */
-    /*
-    treeMenu : function (list) {
-      if (this._treeMenu !== undefined)
-        return this._treeMenu;
-      
-      return this._treeMenu = matchTreeMenuClass.create(this, list);
-    },
-    */
     
     /**
      * Get match element.
diff --git a/dev/js/src/match/info.js b/dev/js/src/match/info.js
index a0b7424..07d4550 100644
--- a/dev/js/src/match/info.js
+++ b/dev/js/src/match/info.js
@@ -5,14 +5,14 @@
   'match/infolayer',
   'match/table',
   'match/tree',
-  'match/reference', // rename to meta
+  'match/meta',
   'match/relations',
   'match/querycreator',
   'util'
 ], function (infoLayerClass,
 	           matchTableClass,
 	           matchTreeClass,
-	           matchRefClass,
+	           matchMetaClass,
              matchRelClass,
              matchQueryCreator) {
   
@@ -33,6 +33,7 @@
       return Object.create(this)._init(match);
     },
 
+
     /**
      * Initialize object
      */
@@ -42,6 +43,7 @@
       return this;
     },
 
+
     /**
      * Get match object
      */
@@ -82,7 +84,7 @@
      * Retrieve and parse snippet for table
      * representation
      */
-    getTable : function (tokens, cb) {
+    getTableData : function (tokens, cb) {
       var focus = [];
 
       // Get all tokens
@@ -138,15 +140,15 @@
     },
 
 
-    getMeta : function (metaInfo, cb) {
-      
+    getMetaData : function (metaInfo, cb) {
+      // ...
     },
     
 
     /**
      * Retrieve and parse snippet for tree representation
      */
-    getTree : function (foundry, layer, type, cb) {
+    getTreeData : function (foundry, layer, type, cb) {
       var focus = [];
       
       // TODO: Support and cache multiple trees
@@ -180,6 +182,7 @@
       );
     },
 
+
     /**
      * Destroy this match information view.
      */
@@ -198,30 +201,29 @@
       // Element destroy
     },
 
+
     /**
      * Add a new tree view to the list
      */
-    addTree : function (foundry, layer, type, cb) {
+    showTree : function (foundry, layer, type, cb) {
       var matchtree = document.createElement('div');
       matchtree.classList.add('matchtree');
-      
-      var h6 = matchtree.appendChild(document.createElement('h6'));
-      h6.appendChild(document.createElement('span'))
-	      .appendChild(document.createTextNode(foundry));
-      h6.appendChild(document.createElement('span'))
-	      .appendChild(document.createTextNode(layer));      
 
-      var tree = matchtree.appendChild(
-        document.createElement('div')
-      );
+      // Add title line
+      var h6 = matchtree.addE('h6');
+      h6.addE('span').addT(foundry);
+      h6.addE('span').addT(layer);      
+
+      var tree = matchtree.addE('div');
       
       this._element.insertBefore(matchtree, this._element.lastChild);
 
-      var actions = tree.appendChild(document.createElement('ul'));
+      // Add close action button
+      var actions = tree.addE('ul');
       actions.classList.add('action', 'image');
-      var close = actions.appendChild(document.createElement('li'));
+      var close = actions.addE('li');
       close.className = 'close';
-      close.appendChild(document.createElement('span'));
+      close.addE('span');
       close.addEventListener(
         'click', function (e) {
           matchtree.parentNode.removeChild(matchtree);
@@ -232,22 +234,22 @@
       tree.classList.add('loading');
 
       // Get tree data async
-      this.getTree(foundry, layer, type, function (treeObj) {
+      this.getTreeData(foundry, layer, type, function (treeObj) {
 
         tree.classList.remove('loading');
 
         // Something went wrong - probably log!!!
 
         if (treeObj === null) {
-          tree.appendChild(document.createTextNode('No data available.'));
+          tree.addT('No data available.');
         }
         else {
           tree.appendChild(treeObj.element());
           treeObj.show();
+
           // Reposition the view to the center
           // (This may in a future release be a reposition
-          // to move the root into the center or the actual
-          // match)
+          // to move the root to the actual match)
 
           // This is currently not supported by relations
           if (type === "spans") {
@@ -255,14 +257,7 @@
             dl.className = 'download';
             dl.addEventListener(
               'click', function (e) {
-
-                var a = document.createElement('a');
-                a.setAttribute('href-lang', 'image/svg+xml');
-                a.setAttribute('href', 'data:image/svg+xml;base64,'+treeObj.toBase64());
-                a.setAttribute('download', 'tree.svg');
-                a.target = '_blank';
-                a.setAttribute('rel', 'noopener noreferrer');
-                
+                var a = treeObj.downloadLink();
                 document.body.appendChild(a);
                 a.click();
                 document.body.removeChild(a)
@@ -283,9 +278,8 @@
 
 
     // Add meta information to match
-    addMeta : function () {
+    showMeta : function () {
       var matchmeta = document.createElement('div');
-      // matchRefClass.create();
 
       // TODO: This is part of the getMeta!
       var metaInfo = this._match.element().getAttribute('data-info');
@@ -297,7 +291,7 @@
       if (metaInfo) {
 
         // Add metainfo to matchview
-        var metaElem = matchRefClass.create(this._match).element(metaInfo);
+        var metaElem = matchMetaClass.create(this._match).element(metaInfo);
         var elem = this.element();
 
         elem.insertBefore(
@@ -307,8 +301,9 @@
       };
     },
 
+
     // Add table
-    addTable : function () {
+    showTable : function () {
 
       var info = this.element();
 
@@ -318,20 +313,21 @@
       info.appendChild(matchtable);
 
       // Create the table asynchronous
-      this.getTable(undefined, function (table) {
+      this.getTableData(undefined, function (table) {
 
         if (table !== null) {
           matchtable.appendChild(table.element());
 	      };
-	      matchtable.classList.remove('loading');
+
+        // Load data
+        matchtable.classList.remove('loading');
 
         // Add query creator
         this._matchCreator = matchQueryCreator.create(info);
       });
-
-      // info.appendChild(this.addTreeMenu());
     },
 
+
     /**
      * Create match information view.
      */
diff --git a/dev/js/src/match/reference.js b/dev/js/src/match/meta.js
similarity index 100%
rename from dev/js/src/match/reference.js
rename to dev/js/src/match/meta.js
diff --git a/dev/js/src/match/tree.js b/dev/js/src/match/tree.js
index 88f0542..c17fe20 100644
--- a/dev/js/src/match/tree.js
+++ b/dev/js/src/match/tree.js
@@ -188,6 +188,9 @@
     },
 
 
+    /**
+     * Create svg and serialize as base64
+     */
     toBase64 : function () {
 
       // First clone element
@@ -310,6 +313,16 @@
       canvas.setAttribute('width', g.graph().width);
       canvas.setAttribute('height', height);
       return this._element;
+    },
+
+    downloadLink : function () {
+      var a = document.createElement('a');
+      a.setAttribute('href-lang', 'image/svg+xml');
+      a.setAttribute('href', 'data:image/svg+xml;base64,' + this.toBase64());
+      a.setAttribute('download', 'tree.svg');
+      a.target = '_blank';
+      a.setAttribute('rel', 'noopener noreferrer');
+      return a;
     }
   };
 });
diff --git a/dev/js/src/match/treeitem.js b/dev/js/src/match/treeitem.js
index ad457b1..68ffe8c 100644
--- a/dev/js/src/match/treeitem.js
+++ b/dev/js/src/match/treeitem.js
@@ -57,7 +57,7 @@
       menu.hide();
       e.halt();
       if (menu.info() !== undefined) {
-	      menu.info().addTree(this._foundry, this._layer, this._type);
+	      menu.info().showTree(this._foundry, this._layer, this._type);
       };
     },
 
diff --git a/dev/js/src/util.js b/dev/js/src/util.js
index d803a9d..719c889 100644
--- a/dev/js/src/util.js
+++ b/dev/js/src/util.js
@@ -33,6 +33,15 @@
 };
 
 
+HTMLElement.prototype.addE = function (tag) {
+  return this.appendChild(document.createElement(tag));
+};
+
+HTMLElement.prototype.addT = function (text) {
+  return this.appendChild(document.createTextNode(text));
+};
+
+
 // Utility for removing all children of a node
 function _removeChildren (node) {
   // Remove everything underneath
@@ -40,6 +49,7 @@
     node.removeChild(node.firstChild);
 };
 
+
 // Utility to get either the charCode
 // or the keyCode of an event
 function _codeFromEvent (e) {
