diff --git a/dev/js/spec/matchSpec.js b/dev/js/spec/matchSpec.js
index 08c0ced..79133ee 100644
--- a/dev/js/spec/matchSpec.js
+++ b/dev/js/spec/matchSpec.js
@@ -395,6 +395,31 @@
       expect(m.matchID).toEqual("p85183-85184");
     });
 
+    it('should be initializable when active', function () {
+      var e = matchElementFactory();
+      e.setAttribute('class', 'active');
+
+      expect(e.classList.contains('active')).toBe(true);
+      expect(e["_match"]).toBe(undefined);
+
+      var m = matchClass.create(e);
+
+      expect(e["_match"]).not.toBe(undefined);
+      
+      // Open the match
+      m.init();
+      
+      expect(e["_match"]).not.toBe(undefined);
+
+      actions = e.querySelector("p.ref > div.action.button-group").children;
+      
+      expect(actions[0].getAttribute("class")).toEqual("metatable");
+      expect(actions[1].getAttribute("class")).toEqual("info");
+      expect(actions[2].getAttribute("class")).toEqual("tree");
+      
+      // Close the match
+      expect(e.querySelector("div.action.button-group > span.minimize")).toBe(null);
+    });
     
     it('should react to gui actions', function () {
       var e = matchElementFactory();
@@ -418,13 +443,15 @@
       expect(actions[0].getAttribute("class")).toEqual("metatable");
       expect(actions[1].getAttribute("class")).toEqual("info");
       expect(actions[2].getAttribute("class")).toEqual("tree");
+
+      expect(e.querySelector("div.action.button-group > span.minimize")).not.toBe(null);
       
       // Close the match
       m.minimize();
       expect(e.classList.contains('active')).toBe(false);
       expect(e["_match"]).not.toBe(undefined);
     });
-
+   
     it('should open tree menu', function () {      
       var e = matchElementFactory();
       var m = matchClass.create(e);
diff --git a/dev/js/src/init.js b/dev/js/src/init.js
index 478f87e..62d0800 100644
--- a/dev/js/src/init.js
+++ b/dev/js/src/init.js
@@ -141,39 +141,53 @@
     /**
      * Add actions to match entries
      */
-    var inactiveLi = d.querySelectorAll(
-      '#search > ol > li:not(.active)'
+    var li = d.querySelectorAll(
+      '#search > ol > li'
     );
     var matchCount = 0;
 
-    for (matchCount = 0; matchCount < inactiveLi.length; matchCount++) {
-      inactiveLi[matchCount].addEventListener('click', function (e) {
-        if (this._match !== undefined)
-          this._match.open();
-        else {
+    for (matchCount = 0; matchCount < li.length; matchCount++) {
+
+      let e = li[matchCount];
+
+      // Define class for active elements
+      if (e.classList.contains('active')) {
+        if (this._match === undefined) {
           // lazyLoad
-          matchClass.create(this).open();
+          matchClass.create(e).init();
         };
-        // This would prevent the sidebar to go back
-        // e.halt();
-      });
-      inactiveLi[matchCount].addEventListener('keydown', function (e) {
-        var code = _codeFromEvent(e);
-        
-        switch (code) {
-        case 32:
+      }
+
+      // Define class for inactive elements
+      else {
+        e.addEventListener('click', function (e) {
           if (this._match !== undefined)
-            this._match.toggle();
+            this._match.open();
           else {
             // lazyLoad
             matchClass.create(this).open();
           };
-          e.halt();
-          break;
-        };
-      });
+          // This would prevent the sidebar to go back
+          // e.halt();
+        });
+        e.addEventListener('keydown', function (e) {
+          var code = _codeFromEvent(e);
+          
+          switch (code) {
+          case 32:
+            if (this._match !== undefined)
+              this._match.toggle();
+            else {
+              // lazyLoad
+              matchClass.create(this).open();
+            };
+            e.halt();
+            break;
+          };
+        });
+      };
     };
-
+    
     // Add focus listener to aside
     var aside = d.getElementsByTagName('aside')[0];
 
diff --git a/dev/js/src/match.js b/dev/js/src/match.js
index 3c44656..f38a68a 100644
--- a/dev/js/src/match.js
+++ b/dev/js/src/match.js
@@ -137,6 +137,44 @@
       return this._avail.rels;
     },
 
+    /**
+     * Initialize match
+     */
+    init : function () {
+      if (this._initialized)
+        return this;
+
+      // Add actions unless it's already activated
+      var element = this._element;
+
+      // There is an element to open
+      if (element === undefined || element === null)
+        return undefined;
+      
+      // Add meta button
+      var refLine = element.querySelector("p.ref");
+
+      // No reference found
+      if (!refLine)
+        return undefined;
+
+      // Create panel
+      this.panel = matchPanelClass.create(this);
+
+      this._element.insertBefore(
+        this.panel.element(),
+        this._element.querySelector("p.ref")
+      );
+
+      // Insert before reference line
+      refLine.insertBefore(
+        this.panel.actions.element(),
+        refLine.firstChild
+      );
+
+      this._initialized = true;
+      return this;
+    },
 
     /**
      * Open match
@@ -157,14 +195,6 @@
       // Add active class to element
       element.classList.add('active');
 
-      // Already there
-      /*
-        if (element.classList.contains('action'))
-        return true;
-      */
-      if (this._initialized)
-        return true;
-      
       var btn = buttonGroupClass.create(
         ['action','button-view']
       );
@@ -174,29 +204,10 @@
         that.minimize();
       });
       element.appendChild(btn.element());
-
-      // Add meta button
-      var refLine = element.querySelector("p.ref");
-
-      // No reference found
-      if (!refLine)
-        return;
-
-      // Create panel
-      this.panel = matchPanelClass.create(this);
-
-      this._element.insertBefore(
-        this.panel.element(),
-        this._element.querySelector("p.ref")
-      );
-
-      // Insert before reference line
-      refLine.insertBefore(
-        this.panel.actions.element(),
-        refLine.firstChild
-      );
-
-      this._initialized = true;
+      
+      if (this.init() == undefined) {
+        return false;
+      };
       
       return true;
     },
