diff --git a/dev/js/src/view.js b/dev/js/src/view.js
index 27d1ab2..77f8d60 100644
--- a/dev/js/src/view.js
+++ b/dev/js/src/view.js
@@ -3,6 +3,8 @@
  * like a tree view or the metadata view.
  */
 
+"use strict";
+
 define(['buttongroup', 'util'], function (buttonGroupClass) {
 
   const loc = KorAP.Locale;
@@ -20,7 +22,7 @@
       this._shown = false;
 
       // The buttonclass is bind to the view
-      var c = ['action', 'button-view'];
+      const c = ['action', 'button-view'];
       if (classes)
         c.push.apply(c,classes);
       
@@ -36,6 +38,7 @@
       return this;
     },
 
+
     /**
      * Element of the view
      */
@@ -46,30 +49,28 @@
       };
 
       // Create panel element
-      var e = document.createElement('div');
+      const e = document.createElement('div');
+      const cl = e.classList;
 
-      var cl = e.classList;
       cl.add('view', 'show');
       if (this._classes)
         cl.add.apply(cl, this._classes);
 
       // TODO: The show may need to be wrapped in another DIV!
       if (this.show !== undefined) {
-        let s = this.show();
+        const s = this.show();
         if (s) {
           e.appendChild(s);
         } else {
           return e
-        }
+        };
       }
 
       this._shown = true;
 
       e.appendChild(this.actions.element());
 
-      this._element = e;
-
-      return e;
+      return this._element = e;
     },
 
 
@@ -90,8 +91,10 @@
       }
     },
 
+
     // onClose : function () {},
 
+    
     /**
      * Close the view.
      */
@@ -101,7 +104,7 @@
       if (this.onClose)
         this.onClose();
 
-      var e = this.element();
+      const e = this.element();
       if (e.parentNode) {
         e.parentNode.removeChild(e);
       };
@@ -109,6 +112,7 @@
       this._shown = false;
     },
 
+
     /**
      * Upgrade this object to another object,
      * while private data stays intact.
@@ -116,7 +120,7 @@
      * @param {Object] An object with properties.
      */
     upgradeTo : function (props) {
-      for (var prop in props) {
+      for (let prop in props) {
         this[prop] = props[prop];
       };
       return this;
diff --git a/dev/js/src/view/match/meta.js b/dev/js/src/view/match/meta.js
index f54c7fb..406c10a 100644
--- a/dev/js/src/view/match/meta.js
+++ b/dev/js/src/view/match/meta.js
@@ -1,3 +1,5 @@
+"use strict";
+
 define([
   'view',
   'match/meta'
@@ -7,7 +9,10 @@
   
   return {
     create : function (match) {
-      return Object.create(viewClass)._init(['metatable']).upgradeTo(this)._init(match);
+      return Object.create(viewClass)
+        ._init(['metatable'])
+        .upgradeTo(this)
+        ._init(match);
     },
 
 
@@ -24,26 +29,24 @@
       if (this._show)
         return this._show;
 
-      var metaTable = document.createElement('div');
+      const metaTable = document.createElement('div');
       metaTable.classList.add('metatable', 'loading');
 
       this.getData(function (meta) {
-
         if (meta === null)
           return;
 
         // Load data
         metaTable.classList.remove('loading');
-
         metaTable.appendChild(meta.element());
       });
 
+
       // TODO:
       //   Loading should have a timeout on view-level
       //   matchtable.classList.remove('loading');
 
-      this._show = metaTable;
-      return metaTable;
+      return this._show = metaTable;
     },
 
 
@@ -61,7 +64,7 @@
      */
     getData : function (cb) {
 
-      var match = this._match;
+      const match = this._match;
       try {
         KorAP.API.getTextInfo(
           match, {}, function (textResponse) {
@@ -71,14 +74,13 @@
               return;
             };
 
-            var doc = textResponse["document"];
-       
+            const doc = textResponse["document"];
             if (doc === undefined) {
               cb(null);
               return;
             };
 
-            var fields = doc["fields"];
+            const fields = doc["fields"];
             if (fields === undefined) {
               cb(null);
               return;
@@ -97,6 +99,7 @@
       };
     },
 
+
     // Delete circular references
     onClose : function () {
       this._match = undefined;
diff --git a/dev/js/src/view/match/relations.js b/dev/js/src/view/match/relations.js
index c61a4ff..1c9bdad 100644
--- a/dev/js/src/view/match/relations.js
+++ b/dev/js/src/view/match/relations.js
@@ -11,7 +11,10 @@
   
   return {
     create : function (match,foundry,layer,type) {
-      return Object.create(viewClass)._init(['relations']).upgradeTo(this)._init(match, foundry, layer, type);
+      return Object.create(viewClass)
+        ._init(['relations'])
+        .upgradeTo(this)
+        ._init(match, foundry, layer, type);
     },
 
 
@@ -33,20 +36,17 @@
       if (this._show)
         return this._show;
 
-      var matchtree = d.createElement('div');
+      const matchtree = d.createElement('div');
       matchtree.classList.add('matchtree', 'loading');
 
-      // this.element().appendChild(matchtree);
-
       // Add title line
-      var h6 = matchtree.addE('h6');
+      const h6 = matchtree.addE('h6');
       h6.addE('span').addT(this._foundry);
       h6.addE('span').addT(this._layer);      
 
       this._tree = matchtree.addE('div');
 
-      this._show = matchtree;
-      return matchtree;
+      return this._show = matchtree;
     },
 
 
@@ -55,13 +55,13 @@
      */
     afterEmbed : function () {
 
-      var foundry = this._foundry,
-          layer = this._layer,
-          type = this._type;
+      const foundry = this._foundry,
+            layer = this._layer,
+            type = this._type;
 
-      var that = this;
-      var tree = this._tree;
-      var matchtree = this._show;
+      const that = this,
+            tree = this._tree,
+            matchtree = this._show;
 
       // Get tree data async
       this.getData(foundry, layer, type, function (treeObj) {
@@ -85,21 +85,20 @@
           if (type === "spans") {
 
             // Download link
-            that.actions.add(loc.DOWNLOAD, {'cls':['button-icon','download']}, function (e) {
-              var a = treeObj.downloadLink();
-              d.body.appendChild(a);
-              a.click();
-              d.body.removeChild(a)
-            });
+            that.actions.add(
+              loc.DOWNLOAD,
+              {'cls':['button-icon','download']},
+              function (e) {
+                const a = treeObj.downloadLink();
+                d.body.appendChild(a);
+                a.click();
+                d.body.removeChild(a)
+              }
+            );
           };
           
           treeObj.center();
         };
-  
-        /*
-          if (cb)
-          cb(treeObj);
-          */
       });
 
       matchtree.classList.remove('loading');
@@ -163,6 +162,7 @@
       };
     },
   
+
     // Delete circular references
     onClose : function () {
       this._match = undefined;
diff --git a/dev/js/src/view/match/tokentable.js b/dev/js/src/view/match/tokentable.js
index e954068..e06ec52 100644
--- a/dev/js/src/view/match/tokentable.js
+++ b/dev/js/src/view/match/tokentable.js
@@ -1,3 +1,5 @@
+"use strict";
+
 define([
   'view',
   'match/table',
@@ -8,7 +10,10 @@
   
   return {
     create : function (match) {
-      return Object.create(viewClass)._init(['tokentable']).upgradeTo(this)._init(match);
+      return Object.create(viewClass)
+        ._init(['tokentable'])
+        .upgradeTo(this)
+        ._init(match);
     },
 
 
@@ -17,6 +22,7 @@
       return this;
     },
     
+
     /**
      * TokenTable view element
      */
@@ -25,12 +31,13 @@
         return this._show;
 
       // Append default table
-      var matchtable = d.createElement('div');
+      const matchtable = d.createElement('div');
       matchtable.classList.add('matchtable', 'loading');
       this._show = matchtable;
       return matchtable;
     },
 
+
     /**
      * Do after embedding
      */
@@ -43,7 +50,7 @@
       //   matchtable.classList.remove('loading');
 
       // var that = this;
-      var matchtable = this._show;
+      const matchtable = this._show;
 
       // Create the table asynchronous
       this.getData(undefined, function (table) {
@@ -52,7 +59,6 @@
           matchtable.appendChild(table.element());
           table.toMark();
 	      };
-
       });
 
       // Load data
@@ -73,12 +79,12 @@
      * representation
      */
     getData : function (tokens, cb) {
-      var focus = [];
+      let focus = [];
 
       // Get all tokens
       if (tokens === undefined) {
         focus = this._match.getTokens();
-      } 
+      }
 
       // Get only some tokens
       else {
@@ -87,7 +93,7 @@
         tokens.forEach(function(term) {
           try {
             // Create info layer objects
-            var layer = infoLayerClass.create(term);
+            const layer = infoLayerClass.create(term);
             layer.type = "tokens";
             focus.push(layer);
           }
@@ -115,8 +121,9 @@
 
             // Get snippet from match info
             if (matchResponse["snippet"] !== undefined) {
-              this._table = matchTableClass.create(matchResponse["snippet"]);
-              cb(this._table);
+              cb(
+                this._table = matchTableClass.create(matchResponse["snippet"])
+              );
             };
           }.bind(this)
         );
@@ -132,6 +139,7 @@
       */
     },
 
+
     // Delete circular references
     onClose : function () {
       this._match = undefined;
diff --git a/dev/js/src/view/result/koralquery.js b/dev/js/src/view/result/koralquery.js
index c456eee..74aec5a 100644
--- a/dev/js/src/view/result/koralquery.js
+++ b/dev/js/src/view/result/koralquery.js
@@ -1,10 +1,14 @@
+"use strict";
+
 define([
   'view',
   'lib/highlight/highlight.pack',
 ], function (viewClass) {
   return {
     create : function (classes) {
-      return Object.create(viewClass)._init(classes).upgradeTo(this);
+      return Object.create(viewClass)
+        ._init(classes)
+        .upgradeTo(this);
     },
 
     /**
@@ -14,10 +18,10 @@
       if (this._show)
         return this._show;
 
-      var kq = document.createElement('div');
+      const kq = document.createElement('div');
       kq.setAttribute('id', 'koralquery');
 
-      var kqInner = kq.addE('div');
+      const kqInner = kq.addE('div');
 
       kqInner.addT(
         JSON.stringify(KorAP.koralQuery || {}, null, '  ')
diff --git a/dev/js/src/view/vc/corpstatv.js b/dev/js/src/view/vc/corpstatv.js
index 316018f..e4aacb0 100644
--- a/dev/js/src/view/vc/corpstatv.js
+++ b/dev/js/src/view/vc/corpstatv.js
@@ -4,7 +4,7 @@
  * @author Helge Stallkamp
  */
 
-define([ 'view', 'vc/statistic', 'buttongroup' ], function(viewClass, statClass, buttonGroup) {
+define([ 'view', 'vc/statistic', 'buttongroup' ], function (viewClass, statClass, buttonGroup) {
 
   // Localization values
   const loc   = KorAP.Locale;
@@ -38,7 +38,7 @@
      */
     getStatistic : function(cb) {
       // cq = corpusQuery
-      var vc = this.vc;
+      const vc = this.vc;
 
       try {
         KorAP.API.getCorpStat(vc.toQuery(), function(statResponse) {
@@ -79,15 +79,13 @@
       if (this._show)
         return this._show; 
       
-      var statTable = document.createElement('div');
+      const statTable = document.createElement('div');
       statTable.classList.add('stattable', 'loading');
   
-      var that = this;
-     
       /*
-      * Get corpus statistic, remove "loading"-image and
-      * append result to statTable
-      */
+       * Get corpus statistic, remove "loading"-image and
+       * append result to statTable
+       */
       this.getStatistic(function(statistic) {
         statTable.classList.remove('loading');
 
@@ -96,57 +94,53 @@
 
         statisticobj = statClass.create(statistic);
         statTable.appendChild(statisticobj.element());
-    
       });
 
-      this._show = statTable;
-      return statTable;
-
+      return this._show = statTable;
     },
-    
 
     
     /**
      * Checks if statistic has to be disabled
      */
-    checkStatActive : function (){
-     var newString = KorAP.vc.toQuery();
-     var oldString = this.vc.oldvcQuery;
-     /*
-      * Do ignore surrounding round brackets
-      * Definining an incomplete docGroup in the vc builder: 
-      * (foo = bar and author = Goethe) and ... 
-      * leads to 
-      * vc.toQuery() -> (foo = bar and author=Goethe)
-      */
+    checkStatActive : function () {
+      let newString = KorAP.vc.toQuery();
+      const oldString = this.vc.oldvcQuery;
+      /*
+       * Do ignore surrounding round brackets
+       * Definining an incomplete docGroup in the vc builder: 
+       * (foo = bar and author = Goethe) and ... 
+       * leads to 
+       * vc.toQuery() -> (foo = bar and author=Goethe)
+       */
   
-     if(newString || newString === ''){
-       if(newString.startsWith('(')){
-         newString = newString.slice(1, newString.length-1);
-       }
+      if (newString || newString === '') {
+        if (newString.startsWith('(')) {
+          newString = newString.slice(1, newString.length-1);
+        };
        
-       if(newString != oldString) {
-        this.disableStat();
-      }  
-     }
-     
-   },
+        if (newString != oldString) {
+          this.disableStat();
+        }
+      }
+    },
    
+
     /**
      * Disabling corpus statistic if in vc builder a different vc is choosen.
      * After clicking at the reload-button the up-to-date corpus statistic is displayed.
      */   
-
     disableStat : function(){
-      var statt = this._show;
+      const statt = this._show;
   
       if (statt.getElementsByClassName('reloadStatB').length == 0) {
-        let btg = buttonGroup.create(['reloadStatB', 'button-panel']);
-        var that = this;
+        const btg = buttonGroup.create(['reloadStatB', 'button-panel']);
+
         btg.add(loc.REFRESH, {'cls':['refresh', 'button-icon']}, function (e) {
           statt.classList.remove('stdisabled');
-          that.panel.reloadCorpStat(); 
-        });
+          this.panel.reloadCorpStat(); 
+        }.bind(this));
+
         statt.appendChild(btg.element());
         statt.classList.add('stdisabled');
       };
