Minor fixes for chrome compatibility
diff --git a/korap.conf b/korap.conf
index 807b772..bbd020c 100644
--- a/korap.conf
+++ b/korap.conf
@@ -20,5 +20,13 @@
   hypnotoad => {
     listen => ['http://*:6666'],
     workers => 3
+  },
+  'TagHelpers-Pagination' => {
+    prev => '<span><i class="fa fa-caret-left"></i></span>',
+    next => '<span><i class="fa fa-caret-right"></i></span>',
+    ellipsis => '<span><i class="fa fa-ellipsis-h"></i></span>',
+    separator => '',
+    current => '<span>{current}</span>',
+    page => '<span>{page}</span>'
   }
 }
diff --git a/lib/Korap.pm b/lib/Korap.pm
index f79ef61..259383b 100644
--- a/lib/Korap.pm
+++ b/lib/Korap.pm
@@ -3,28 +3,27 @@
 
 our $VERSION = '0.03';
 
-# This method will run once at server start
+# Start the application and register all routes and plugins
 sub startup {
   my $self = shift;
 
+  # Set secret for signed cookies
   $self->secrets(['fmhsfjgfchgsdbfgshfxztsbt32477eb45veu4vubrghfgghbtv']);
 
-  $self->plugin('Config');
-  $self->plugin('CHI');
-  $self->plugin('TagHelpers::Pagination' => {
-    prev => '<span><i class="fa fa-caret-left"></i></span>',
-    next => '<span><i class="fa fa-caret-right"></i></span>',
-    ellipsis => '<span><i class="fa fa-ellipsis-h"></i></span>',
-    separator => '',
-    current => '<span>{current}</span>',
-    page => '<span>{page}</span>'
-  });
-  $self->plugin('Notifications');
-  $self->plugin('Number::Commify');
+  # Add additional plugin path
   push(@{$self->plugins->namespaces}, __PACKAGE__ . '::Plugin');
-  $self->plugin('KorapSearch');
-  $self->plugin('KorapInfo');
-  $self->plugin('KorapTagHelpers');
+
+  # Load plugins
+  foreach (qw/Config
+	      CHI
+	      TagHelpers::Pagination
+	      Notifications
+	      Number::Commify
+	      KorapSearch
+	      KorapInfo
+	      KorapTagHelpers/) {
+    $self->plugin($_);
+  };
 
   $self->helper(
     date_format => sub {
@@ -36,40 +35,29 @@
   # Routes
   my $r = $self->routes;
 
-  # Create search endpoint
-  $r->add_shortcut(
-    search => sub {
-      shift->route('/search')->to('search#remote')
-    }
-  );
-
+  # Base search route
   $r->get('/')->to('search#remote')->name('index');
-  $r->get('/util/query')->to('search#query');
 
-  # Tutorial
-  $r->get('/tutorial/(*tutorial)', { tutorial => 'start' })->to('tutorial#page')->name('tutorial');
+  # Tutorial data
+  $r->get('/tutorial/(*tutorial)', { tutorial => 'start' })
+    ->to('tutorial#page')->name('tutorial');
 
+  # Collection data
   my $collection = $r->route('/collection');
   $collection->to('search#info');
   $collection->search;
 
+  # Corpus data
   my $corpus = $r->route('/corpus');
   $corpus->search;
   $corpus->route('/:corpus_id')->search;
-  $corpus->route('/:corpus_id/:doc_id')->search;
-  $corpus->route('/:corpus_id/#doc_id/:match_id')->to('info#about_match');
+  $corpus->route('/:corpus_id/#doc_id')->search;
+  $corpus->route('/:corpus_id/#doc_id/:match_id')
+         ->to('info#about_match');
 
-
-
-#  $r->get(
-#    '/:resource/:corpus_id/#doc_id/#match_id',
-#    resource => [qw/collection corpus/])->to('search#match')->name('match');
- # /matchInfo?id=...&f=&l=&spans
+  # Utilities
+  $r->get('/util/query')->to('search#query');
 };
 
 
 1;
-
-__END__
-
-  # TODO: Write search snippet
diff --git a/lib/Korap/Plugin/KorapInfo.pm b/lib/Korap/Plugin/KorapInfo.pm
index a1f3af8..5ef48d3 100644
--- a/lib/Korap/Plugin/KorapInfo.pm
+++ b/lib/Korap/Plugin/KorapInfo.pm
@@ -3,6 +3,9 @@
 use Mojo::JSON qw/decode_json/;
 use Mojo::ByteStream 'b';
 
+# Todo: Make the requests non-blocking
+
+# Register plugin
 sub register {
   my ($plugin, $mojo, $param) = @_;
   $param ||= {};
@@ -12,37 +15,43 @@
     $param = { %$param, %$config_param };
   };
 
+  # Temporary info data
   state $json = decode_json(b(join('', <DATA>))->encode);
 
+  # Get the API endpoint
   my $api = $param->{api};
 
   # Todo: Make this recognize the user!
   $mojo->helper(
     resource_info => sub {
       my $c = shift;
-
       my $src = shift;
 
+      # Dispatch for test mode
       if ($c->app->mode eq 'test') {
 	if ($src eq 'collection') {
 	  return $json->{collections};
 	};
       };
 
+      # Rename info endpoints and build URL
       $src = 'VirtualCollection' if $src eq 'collection';
       $src = 'Corpus' if $src eq 'corpus';
-
       my $url = Mojo::URL->new($api)->path('resource/' . $src);
 
-      my $chi = $c->chi;
-      if (my $json = $chi->get($url->to_string)) {
+      # Check for cached information
+      if (my $json = $c->chi->get($url->to_string)) {
 	return $json;
       }
+
+      # Retrieve and set the cache
       elsif (my $response = $c->ua->get($url)->success) {
 	my $json = $response->json;
-	$c->chi->set($url->to_string => $json);
+	$c->chi->set($url->to_string => $json, '24 hours');
 	return $json;
       };
+
+      # Something went wrong
       $c->notify(error => 'Unable to retrieve resource');
       return [];
     }
@@ -55,8 +64,12 @@
 
       return $json->{matchInfo} if $c->app->mode eq 'test';
 
+      # Build url
       my $url = Mojo::URL->new($api)->path('resource/matchInfo');
+
+      # Build match id
       $match = 'match-' . $corpus . '!' . $corpus . '_' . $doc . '-' . $match;
+
       $url->query({
 	id => $match,
 	f => 'mate',
@@ -76,16 +89,51 @@
 1;
 
 __DATA__
-
 {
-"matchInfo":
-
-{"author":"Filzstift,Alexander Sommer,TheK","textClass":"freizeit-unterhaltung reisen","corpusID":"WPD","title":"Neuseeland","foundries":"xip xip/morpho xip/constituency xip/dependency corenlp corenlp/namedentities corenlp/namedentities/ne_dewac_175m_600 corenlp/namedentities corenlp/namedentities/ne_hgc_175m_600 mate mate/morpho mate/dependency connexor connexor/morpho connexor/syntax connexor/phrase treetagger treetagger/morpho base base/sentences base/paragraphs opennlp opennlp/morpho","tokenization":"opennlp#tokens","field":"tokens","startMore":false,"endMore":false,"docID":"WPD_NNN.02848","snippet":"<span class=\"context-left\"></span><span class=\"match\"><span title=\"mate/l:besonders\"><span title=\"mate/p:ADV\">Besonders</span></span> <span title=\"mate/l:auffällig\"><span title=\"mate/m:degree:pos\"><span title=\"mate/p:ADJD\">auffällig</span></span></span> <span title=\"mate/l:sein\"><span title=\"mate/m:mood:ind\"><span title=\"mate/m:number:pl\"><span title=\"mate/m:person:3\"><span title=\"mate/m:tense:pres\"><span title=\"mate/p:VAFIN\">sind</span></span></span></span></span></span> <span title=\"mate/l:schließlich\"><span title=\"mate/p:ADV\">schließlich</span></span> <span title=\"mate/l:noch\"><span title=\"mate/p:ADV\">noch</span></span> <span title=\"mate/l:der\"><span title=\"mate/m:case:nom\"><span title=\"mate/m:gender:masc\"><span title=\"mate/m:number:sg\"><span title=\"mate/p:ART\">der</span></span></span></span></span> <span title=\"mate/l:pohutukawa\"><span title=\"mate/m:case:nom\"><span title=\"mate/m:gender:masc\"><span title=\"mate/m:number:sg\"><span title=\"mate/p:NE\">Pohutukawa</span></span></span></span></span> <span title=\"mate/l:und\"><span title=\"mate/p:KON\">und</span></span> <span title=\"mate/l:der\"><span title=\"mate/m:case:nom\"><span title=\"mate/m:gender:masc\"><span title=\"mate/m:number:sg\"><span title=\"mate/p:ART\">der</span></span></span></span></span> <span title=\"mate/l:cabbage\"><span title=\"mate/m:case:nom\"><span title=\"mate/m:gender:masc\"><span title=\"mate/m:number:sg\"><span title=\"mate/p:NE\">Cabbage</span></span></span></span></span> <span title=\"mate/l:tree\"><span title=\"mate/m:gender:masc\"><span title=\"mate/m:number:sg\"><span title=\"mate/p:NE\"><span title=\"mate/m:case:nom\">Tree</span></span></span></span></span></span><span class=\"context-right\"></span>","ID":"match-WPD!WPD_NNN.02848-p1213-1224","pubDate":"2005-03-28","context":{"left":["token",0],"right":["token",0]}},
-
-
-"collections" :
-[{"shared":false,"id":1,"managed":true,"created":1401193381119,"stats":{"documents":196510,"tokens":51545081,"sentences":4116282,"paragraphs":2034752},"query":[{"@type":"korap:meta-filter","@value":{"@type":"korap:term","@field":"korap:field#corpusID","@value":"WPD"}}],"description":"Die freie Enzyklopädie","name":"Wikipedia","foundries":"base;corenlp;mate;mpt;opennlp;tt;xip"}]
-
-
-
+  "matchInfo": {
+    "author":"Filzstift,Alexander Sommer,TheK",
+    "textClass":"freizeit-unterhaltung reisen",
+    "corpusID":"WPD",
+    "title":"Neuseeland",
+    "foundries":"xip xip/morpho xip/constituency xip/dependency corenlp corenlp/namedentities corenlp/namedentities/ne_dewac_175m_600 corenlp/namedentities corenlp/namedentities/ne_hgc_175m_600 mate mate/morpho mate/dependency connexor connexor/morpho connexor/syntax connexor/phrase treetagger treetagger/morpho base base/sentences base/paragraphs opennlp opennlp/morpho",
+    "tokenization":"opennlp#tokens",
+    "field":"tokens",
+    "startMore":false,
+    "endMore":false,
+    "docID":"WPD_NNN.02848",
+    "snippet":"<span class=\"context-left\"></span><span class=\"match\"><span title=\"mate/l:besonders\"><span title=\"mate/p:ADV\">Besonders</span></span> <span title=\"mate/l:auffällig\"><span title=\"mate/m:degree:pos\"><span title=\"mate/p:ADJD\">auffällig</span></span></span> <span title=\"mate/l:sein\"><span title=\"mate/m:mood:ind\"><span title=\"mate/m:number:pl\"><span title=\"mate/m:person:3\"><span title=\"mate/m:tense:pres\"><span title=\"mate/p:VAFIN\">sind</span></span></span></span></span></span> <span title=\"mate/l:schließlich\"><span title=\"mate/p:ADV\">schließlich</span></span> <span title=\"mate/l:noch\"><span title=\"mate/p:ADV\">noch</span></span> <span title=\"mate/l:der\"><span title=\"mate/m:case:nom\"><span title=\"mate/m:gender:masc\"><span title=\"mate/m:number:sg\"><span title=\"mate/p:ART\">der</span></span></span></span></span> <span title=\"mate/l:pohutukawa\"><span title=\"mate/m:case:nom\"><span title=\"mate/m:gender:masc\"><span title=\"mate/m:number:sg\"><span title=\"mate/p:NE\">Pohutukawa</span></span></span></span></span> <span title=\"mate/l:und\"><span title=\"mate/p:KON\">und</span></span> <span title=\"mate/l:der\"><span title=\"mate/m:case:nom\"><span title=\"mate/m:gender:masc\"><span title=\"mate/m:number:sg\"><span title=\"mate/p:ART\">der</span></span></span></span></span> <span title=\"mate/l:cabbage\"><span title=\"mate/m:case:nom\"><span title=\"mate/m:gender:masc\"><span title=\"mate/m:number:sg\"><span title=\"mate/p:NE\">Cabbage</span></span></span></span></span> <span title=\"mate/l:tree\"><span title=\"mate/m:gender:masc\"><span title=\"mate/m:number:sg\"><span title=\"mate/p:NE\"><span title=\"mate/m:case:nom\">Tree</span></span></span></span></span></span><span class=\"context-right\"></span>",
+    "ID":"match-WPD!WPD_NNN.02848-p1213-1224",
+    "pubDate":"2005-03-28",
+    "context":{
+      "left":["token",0],
+      "right":["token",0]
+    }
+  },
+  "collections" : [
+    {
+      "shared":false,
+      "id":1,
+      "managed":true,
+      "created":1401193381119,
+      "stats":{
+        "documents":196510,
+        "tokens":51545081,
+        "sentences":4116282,
+        "paragraphs":2034752
+      },
+      "query":[
+        {
+          "@type":"korap:meta-filter",
+          "@value":{
+            "@type":"korap:term",
+            "@field":"korap:field#corpusID",
+            "@value":"WPD"
+          }
+        }
+      ],
+      "description":"Die freie Enzyklopädie",
+      "name":"Wikipedia",
+      "foundries":"base;corenlp;mate;mpt;opennlp;tt;xip"
+    }
+  ]
 }
diff --git a/lib/Korap/Plugin/KorapSearch.pm b/lib/Korap/Plugin/KorapSearch.pm
index 39b5c15..015a1a8 100644
--- a/lib/Korap/Plugin/KorapSearch.pm
+++ b/lib/Korap/Plugin/KorapSearch.pm
@@ -5,6 +5,7 @@
 
 # TODO: This will probably be an engine for M::P::Search
 # cutoff has to be true or false
+# TODO: Write search snippet
 
 sub register {
   my ($plugin, $mojo, $param) = @_;
@@ -37,6 +38,13 @@
     }
   );
 
+  # Create search endpoint
+  $mojo->routes->add_shortcut(
+    search => sub {
+      shift->route('/search')->to('search#remote')
+    }
+  );
+
   $mojo->helper(
     search => sub {
       my $c = shift;
diff --git a/public/hint.js b/public/hint.js
index cd8082a..b79dcd5 100644
--- a/public/hint.js
+++ b/public/hint.js
@@ -224,7 +224,7 @@
 
   // Initialize style
   init();
-  search.addEventListener("keyup",    changed,  false);
+  search.addEventListener("keyup",   changed,  false);
   search.addEventListener("keydown", select,   false);
-  qlField.addEventListener('change',  qlSelect, false);
+  qlField.addEventListener('change', qlSelect, false);
 };
diff --git a/templates/layouts/default.html.ep b/templates/layouts/default.html.ep
index 2eb7a7c..5d18d45 100644
--- a/templates/layouts/default.html.ep
+++ b/templates/layouts/default.html.ep
@@ -115,13 +115,16 @@
 
 %= javascript begin
 
-$("ol > li:not(.active)").on("click", function () {
+$("#search > ol > li:not(.active)").on("click", function (e) {
   $(this).addClass('active');
+  e.stopPropagation();
 });
 
-function closeSnippet (o) {
-  $(o.parentNode.parentNode).removeClass('active');
-};
+$("#search > ol > li:not(.active) > ul > li.close").on("click", function (e) {
+  $(this.parentNode.parentNode).removeClass('active');
+  e.stopPropagation();
+});
+
 
 function showTable (o) {
   var match = o.parentNode.parentNode;
@@ -137,9 +140,9 @@
   };
 
   var corpusID = match.getAttribute('data-corpus-id');
-  var docID = match.getAttribute('data-doc-id');
-  var matchID = match.getAttribute('data-match-id');
-  var url = '/corpus/' + corpusID + '/' + docID + '/' + matchID;
+  var docID    = match.getAttribute('data-doc-id');
+  var matchID  = match.getAttribute('data-match-id');
+  var url      = '/corpus/' + corpusID + '/' + docID + '/' + matchID;
   var snippet;
 
   jQuery.getJSON(url, function (res) {
@@ -169,7 +172,7 @@
   closeTutorial();
 };
 
-$("code.query.serial,#sidebar").on("click", function () {
+$("code.query.serial, #sidebar").on("click", function () {
   $(this).toggleClass('active');
 });
 
diff --git a/templates/search.html.ep b/templates/search.html.ep
index c393c72..091fd39 100644
--- a/templates/search.html.ep
+++ b/templates/search.html.ep
@@ -35,7 +35,7 @@
       as <%= $_->{docID} %> (<%= $_->{corpusID} %>)
     </p>
     <ul class="action right">
-      <li onmouseup="closeSnippet(this)" title="close"><i class="fa fa-toggle-up"></i></li>
+      <li class="close" title="close"><i class="fa fa-toggle-up"></i></li>
       <li onclick="showTable(this)" title="Annotations"><i class="fa fa-info-circle"></i></li>
 <!--
       <li title="Tree Visualizations"><i class="fa fa-sitemap"></i></li>