diff --git a/dev/js/spec/matchSpec.js b/dev/js/spec/matchSpec.js
index f71ba56..a51fd78 100644
--- a/dev/js/spec/matchSpec.js
+++ b/dev/js/spec/matchSpec.js
@@ -260,17 +260,18 @@
 
   var afterAllFunc = function () {
     KorAP.API.getMatchInfo = undefined;
-    // KorAP.annotationHelper = undefined;
+    KorAP.TreeMenu = undefined;
     var body = document.body;
-    for (var i in body.children) {
+    var i = body.children.length - 1;
+    while (i >= 0) {
       if (body.children[i].nodeType && body.children[i].nodeType === 1) {
         if (!body.children[i].classList.contains("jasmine_html-reporter")) {
           body.removeChild(body.children[i]);
         };
       };
+      i--;
     };
   };
-
   
   describe('KorAP.InfoLayer', function () {
     beforeAll(beforeAllFunc);
@@ -404,10 +405,10 @@
 
       expect(e.classList.contains('active')).toBe(false);
       expect(e["_match"]).not.toBe(undefined);
-
+      
       // Open the match
       m.open();
-
+      
       expect(e.classList.contains('active')).toBe(true);
       expect(e["_match"]).not.toBe(undefined);
 
@@ -430,21 +431,20 @@
       var relation = e.querySelector("p.ref > div.action.button-group > span:nth-of-type(3)");
       expect(relation.getAttribute("class")).toEqual("tree");
       expect(document.getElementsByClassName("button-group-list").length).toEqual(0);
-
       expect(document.activeElement.tagName).toEqual("BODY");
-
+ 
       // Show menu
       relation.click();
       expect(document.getElementsByClassName("button-group-list").length).toEqual(1);
-
       expect(document.activeElement.tagName).toEqual("UL");
-
+      
       // Choose first tree
       document.getElementsByClassName("button-group-list")[0].getElementsByTagName("li")[1].click();
       expect(e.querySelector("div.matchinfo div.matchtree h6 span").innerText).toEqual("corenlp");
 
       // This should blur the focus
       expect(document.activeElement.tagName).toEqual("BODY");
+      
     });
 
   });
diff --git a/dev/js/spec/tourSpec.js b/dev/js/spec/tourSpec.js
index 4bb71ef..e495be4 100644
--- a/dev/js/spec/tourSpec.js
+++ b/dev/js/spec/tourSpec.js
@@ -1,13 +1,11 @@
 /**
- * Test suite for guided tour.
+ * Test suite for guided tour
  * 
  * @author Helge Stallkamp
  */
 
-define(['tour/tours', 'vc', 'session'], function(tourClass, vcClass, sessionClass){
+define(['tour/tours', 'vc', 'session', 'match'], function(tourClass, vcClass, sessionClass, matchClass){
   const loc   = KorAP.Locale;
- 
-  //TODO Read this file from the file system, see https://korap.ids-mannheim.de/gerrit/#/c/KorAP/Kalamar/+/2241/
   var introKorAP =
   	"<form autocomplete='off' action='/' id='searchform'>" + 
     "<div id='searchbar' class=''>" +
@@ -78,11 +76,320 @@
   }; 
   
 
+  var resultkorap =  
+    "<div id='search'>" +
+      "<ol class='align-left' tabindex='-8'>" +
+        "<li data-corpus-id='WPD' " +
+          "data-doc-id='WWW'" +
+          "data-text-id='03313'" +
+          "data-match-id='p102-103'" +
+          "data-available-info='base/s=spans corenlp/c=spans corenlp/ne=tokens corenlp/p=tokens corenlp/s=spans glemm/l=tokens mate/l=tokens mate/m=tokens mate/p=tokens opennlp/p=tokens opennlp/s=spans tt/l=tokens tt/p=tokens tt/s=spans xip/c=spans malt/d=rels'"+
+          "id='WPD-WWW.03313-p102-103'" +
+          "tabindex='6'>" +
+          "<div class='meta'>WPD/WWW/03313</div>" +
+          "<div class='match-main'>" +
+            "<div class='match-wrap'>" +
+              "<div class='snippet startMore endMore'>" +
+                "<div class='flag'></div>" +
+                "<span class='context-left'>In diesem Beispiel ist zu sehen, dass die beiden Variablen a und b lediglich ihre Werte an" +
+                " die Funktion </span><mark><mark class='class-2 level-1'>Dies </mark><mark class='class-1 level-0'><mark class='class-2 level-1'><mark class='class-3 level-2'>ist</mark>" +
+                " ein</mark> Test</mark></mark><span class='context-right'> übergeben, aber im Gegensatz zu einem Referenzparamter dabei unverändert bleiben.</span></div>" + 
+              "</div>"+
+              "<!-- only inject via javascript! -->" +
+             "</div>" + 
+             "<p class='ref'><strong>Wertparameter</strong> by Hubi,Zwobot,4; published on 2005-03-28 as WWW.03313 (WPD)</p>" +
+             "<!-- only inject via javascript! -->" +
+           "</li>" + 
+      "</div>"; 
+
+
+
+  var snippet = "<span title=\"cnx/l:meist\">" +
+      "  <span title=\"cnx/p:ADV\">" +
+      "    <span title=\"cnx/syn:@PREMOD\">" +
+      "      <span title=\"mate/l:meist\">" +
+      "        <span title=\"mate/l:meist\">" +
+      "          <span title=\"mate/p:ADV\">" +
+      "            <span title=\"opennlp/p:ADV\">meist</span>" +
+      "          </span>" +
+      "        </span>" +
+      "      </span>" +
+      "    </span>" +
+      "  </span>" +
+      "</span>" +
+      "<mark>" + 
+      "<span title=\"cnx/l:deutlich\">" +
+      "  <span title=\"cnx/p:A\">" +
+      "    <span title=\"cnx/syn:@PREMOD\">" +
+      "      <span title=\"mate/l:deutlich\">" +
+      "        <span title=\"mate/m:degree:pos\">" +
+      "          <span title=\"mate/p:ADJD\">" +
+      "            <span title=\"opennlp/p:ADJD\">deutlich</span>" +
+      "          </span>" +
+      "        </span>" +
+      "      </span>" +
+      "    </span>" +
+      "  </span>" +
+      "</span>" +
+      "</mark>" +
+      "<span title=\"cnx/l:fähig\">" +
+      "  <span title=\"cnx/l:leistung\">" +
+      "    <span title=\"cnx/p:A\">" +
+      "      <span title=\"cnx/p:ADJA\">" +
+      "        <span title=\"cnx/syn:@NH\">" +
+      "          <span title=\"mate/l:leistungsfähig\">" +
+      "            <span title=\"mate/m:degree:comp\">" +
+      "              <span title=\"mate/p:ADJD\">" +
+      "                <span title=\"opennlp/p:ADJD\">leistungsfähiger</span>" +
+      "              </span>" +
+      "            </span>" +
+      "          </span>" +
+      "        </span>" +
+      "      </span>" +
+      "    </span>" +
+      "  </span>" +
+      "</span>";
+
+  var treeSnippet =
+      "<span class=\"context-left\"></span>" +
+      "<span class=\"match\">" +
+      "  <span title=\"xip/c:MC\">" +
+      "    <span title=\"xip/c:TOP\">" +
+      "      <span title=\"xip/c:PP\">" +
+      "        <span title=\"xip/c:PREP\">Mit</span>" +
+      "        <span title=\"xip/c:NP\">" +
+      "          <span title=\"xip/c:DET\">dieser</span>" +
+      "          <span title=\"xip/c:NPA\">" +
+      "            <span title=\"xip/c:NOUN\">Methode</span>" +
+      "          </span>" +
+      "        </span>" +
+      "      </span>" +
+      "      <span title=\"xip/c:VERB\">ist</span>" +
+      "      <mark>" +
+      "        <span title=\"xip/c:NP\">" +
+      "          <span title=\"xip/c:PRON\">es</span>" +
+      "        </span>" +  
+      "        <span title=\"xip/c:AP\">" +
+      "          <span title=\"xip/c:ADV\">nun</span>" +
+      "          <span title=\"xip/c:ADJ\">möglich</span>" +
+      "        </span>" +
+      "      </mark>" +
+      "      <span title=\"xip/c:ADV\">z. B.</span>" +
+      "      <span title=\"xip/c:NPA\">" +
+      "        <span title=\"xip/c:NP\">" +
+      "          <span title=\"xip/c:NOUN\">Voice</span>" +
+      "        </span>" +
+      "      </span>" + "(" +
+      "      <span title=\"xip/c:INS\">" +
+      "        <span title=\"xip/c:NPA\">" +
+      "          <span title=\"xip/c:NP\">" +
+      "            <span title=\"xip/c:NOUN\">Sprache</span>" +
+      "          </span>" +
+      "        </span>" +
+      "      </span>" + ")" +
+      "      <span title=\"xip/c:VERB\">bevorzugt</span>" +
+      "      <span title=\"xip/c:PP\">" +
+      "        <span title=\"xip/c:PREP\">in</span>" +
+      "        <span title=\"xip/c:NP\">" +
+      "          <span title=\"xip/c:PRON\">der</span>" +
+      "        </span>" +
+      "        <span title=\"xip/c:NPA\">" +
+      "          <span title=\"xip/c:NP\">" +
+      "            <span title=\"xip/c:NOUN\">Bridge</span>" +
+      "          </span>" +
+      "        </span>" +
+      "      </span>" +
+      "      <span title=\"xip/c:INFC\">" +
+      "        <span title=\"xip/c:INS\">" +
+      "          <span title=\"xip/c:VERB\">weiterzugeben</span>" +
+      "        </span>" +
+      "      </span>" +
+      "    </span>" +
+      "  </span>" +
+      "</span>" +
+      "<span class=\"context-right\"></span>";
+  
+  KorAP.API.getTextInfo = function (doc, param, cb) {
+    cb(textInfo);
+  };
+
+    // Override getMatchInfo API call
+    KorAP.API.getMatchInfo = function (x, param, cb) {
+      if (param['spans'] === undefined || param['spans'] === false)
+        cb({ "snippet": snippet });
+      else
+        cb({ "snippet": treeSnippet });
+    };
+
+    var textInfo = {
+        "@context":"http:\/\/korap.ids-mannheim.de\/ns\/KoralQuery\/v0.3\/context.jsonld",
+        "document":{
+          "@type":"koral:document",
+          "fields":[
+            {
+              "@type":"koral:field",
+              "key":"editor",
+              "type":"type:store",
+              "value":"wikipedia.org"
+            },
+            {
+              "@type":"koral:field",
+              "key":"textSigle",
+              "type":"type:string",
+              "value":"WPD15\/264\/58336"
+            },
+            {
+              "@type":"koral:field",
+              "key":"author",
+              "type":"type:text",
+              "value":"Sprachpfleger, u.a."
+            },
+            {
+              "@type":"koral:field",
+              "key":"docSigle",
+              "type":"type:string",
+              "value":"WPD15\/264"
+            },
+            {
+              "@type":"koral:field",
+              "key":"textTypeArt",
+              "type":"type:string",
+              "value":"Enzyklopädie-Artikel"
+            },
+            {
+              "@type":"koral:field",
+              "key":"language",
+              "type":"type:string",
+              "value":"de"
+            },
+            {
+              "@type":"koral:field",
+              "key":"docTitle",
+              "type":"type:text",
+              "value":"Wikipedia, Artikel mit Anfangszahl 2, Teil 64"
+            },
+            {
+              "@type":"koral:field",
+              "key":"textType",
+              "type":"type:string",
+              "value":"Enzyklopädie"
+            },
+            {
+              "@type":"koral:field",
+              "key":"availability",
+              "type":"type:string",
+              "value":"CC-BY-SA"
+            },
+            {
+              "@type":"koral:field",
+              "key":"foundries",
+              "type":"type:keywords",
+              "value":[
+                "corenlp",
+                "corenlp\/constituency",
+                "corenlp\/morpho",
+                "corenlp\/sentences",
+                "dereko",
+                "dereko\/structure",
+                "dereko\/structure\/base-sentences-paragraphs-pagebreaks",
+                "opennlp",
+                "opennlp\/morpho",
+                "opennlp\/sentences"
+              ]
+            },
+            {
+              "@type":"koral:field",
+              "key":"creationDate",
+              "type":"type:date",
+              "value":"2015-04-17"
+            },
+            {
+              "@type":"koral:field",
+              "key":"title",
+              "type":"type:text",
+              "value":"22:43 – Das Schicksal hat einen Plan"
+            },
+            {
+              "@type":"koral:field",
+              "key":"pubDate",
+              "type":"type:date",
+              "value":"2015-05-01"
+            },
+            {
+              "@type":"koral:field",
+              "key":"reference",
+              "type":"type:store",
+              "value":"22:43 – Das Schicksal hat einen Plan, In: Wikipedia - URL:http:\/\/de.wikipedia.org\/wiki\/22:43_–_Das_Schicksal_hat_einen_Plan: Wikipedia, 2015"
+            },
+            {
+              "@type":"koral:field",
+              "key":"textClass",
+              "type":"type:keywords",
+              "value":["kultur","film"]
+            },
+            {
+              "@type":"koral:field",
+              "key":"tokenSource",
+              "type":"type:store",
+              "value":"base#tokens"
+            },
+            {
+              "@type":"koral:field",
+              "key":"publisher",
+              "type":"type:store",
+              "value":"Wikipedia"
+            },
+            {
+              "@type":"koral:field",
+              "key":"layerInfos",
+              "type":"type:store",
+              "value":"corenlp\/c=spans corenlp\/p=tokens corenlp\/s=spans dereko\/s=spans opennlp\/p=tokens opennlp\/s=spans"
+            },
+            {
+              "@type":"koral:field",
+              "key":"pubPlace",
+              "type":"type:string",
+              "value":"URL:http:\/\/de.wikipedia.org"
+            },
+            {
+              "@type":"koral:field",
+              "key":"corpusTitle",
+              "type":"type:text",
+              "value":"Wikipedia"
+            },
+            {
+              "@type":"koral:field",
+              "key":"corpusEditor",
+              "type":"type:store",
+              "value":"wikipedia.org"
+            },
+            {
+              "@type":"koral:field",
+              "key":"corpusSigle",
+              "type":"type:string",
+              "value":"WPD15"
+            }
+          ]
+        }
+      };
   let template = document.createElement('template');
   let html = introKorAP.trim(); // Do not return a text node of whitespace as the result
   template.innerHTML = html;
   let intrkorap = template.content;
   
+  let resulttemplate = document.createElement('template');
+  let htmlZwei = resultkorap.trim(); 
+  resulttemplate.innerHTML = resultkorap;
+  var resultkor = resulttemplate.content;
+
+  resultkor.querySelector('#search > ol > li:not(.active)').addEventListener('click', function (e) {
+    if (this._match !== undefined)
+      this._match.open();
+    else {
+      matchClass.create(this).open();
+    }
+  });
+  
   let vc= vcClass.create().fromJson({
     '@type' : 'koral:doc',
     'key' : 'title', 
@@ -92,10 +399,25 @@
   });
   
   KorAP.vc = vc;
-  //TODO Add hint and vc-choose, they are not part of the generated file
-  
+
   describe('KorAP.GuidedTour', function(){
+
+    afterAll(function () {
+      KorAP.API.getMatchInfo = undefined;
+      var body = document.body;
+      var i = body.children.length - 1;
+      while (i >= 0) {
+        if (body.children[i].nodeType && body.children[i].nodeType === 1) {
+          if (!body.children[i].classList.contains("jasmine_html-reporter")) {
+            body.removeChild(body.children[i]);
+          };
+        };
+        i--;
+      };
+    })
+        
     it('IDs and classes, that are needed for the guided tour should be in existence', function(){
+      //gTstartSearch
       expect(intrkorap.querySelector('#searchbar')).not.toBeNull();
       expect(intrkorap.querySelector('#q-field')).not.toBeNull();
       expect(intrkorap.querySelector('#hint')).not.toBeNull();
@@ -111,12 +433,20 @@
       expect(statbut).not.toBeNull();
       statbut.click();
       expect(show.querySelector('.stattable')).not.toBeNull();
+      //IDs and classes, that are needed for the second guided tour(gTshowResults()) should be in existence, too
+      expect(resultkor.querySelector('#search')).not.toBeNull();
+      expect(resultkor.querySelector('#search > ol > li')).not.toBeNull();
+      resultkor.querySelector("#search > ol > li").click();      
+      expect(resultkor.querySelector('.action > .metatable')).not.toBeNull();
+      resultkor.querySelector(".metatable").click();
+      expect(resultkor.querySelector('.view.metatable')).not.toBeNull();
+      expect(resultkor.querySelector('.action > .info')).not.toBeNull();
+      resultkor.querySelector(".info").click();
+      expect(resultkor.querySelector('.view.tokentable')).not.toBeNull();
+      expect(resultkor.querySelector('.tree')).not.toBeNull(); 
     });
-    
-   
-  
+      
    it('Guided Tour should be started and display steps and labels in the right order', function(){
-   
      let vcpanel = intrkorap.getElementById("vc-view");
      vcpanel.appendChild(vc.element());
      let searchTour = tourClass.gTstartSearch(intrkorap);
@@ -140,14 +470,24 @@
        searchTour.exit();
      } 
      
-     let resultTour = tourClass.gTshowResults(intrkorap);
+     let resultTour = tourClass.gTshowResults(resultkor);
      KorAP.session = sessionClass.create('KalamarJSDem'); 
-     resultTour.start();
-     expect(document.querySelector(".introjs-tooltiptext").textContent).toEqual(loc.TOUR_result);
-     expect(document.querySelector(".introjs-donebutton").textContent).toEqual(loc.TOUR_ldone);   
+     resultTour.start(resultkor);
+     let totalStepsR = resultTour.stepCount;
+     expect(document.querySelector(".introjs-tooltiptext").textContent).toEqual(loc.TOUR_kwic);
+     expect(document.querySelector(".introjs-skipbutton").textContent).toEqual(loc.TOUR_lskip);
+     expect(document.querySelector(".introjs-prevbutton").textContent).toEqual(loc.TOUR_lprev);
+     expect(document.querySelector(".introjs-nextbutton").textContent).toEqual(loc.TOUR_lnext);
      resultTour.exit();
-    
-   }); 
+     
+    for(let i = 2; i <= totalStepsR; i++){
+       resultTour.goToStepNumber(i);
+       expect(document.querySelector(".introjs-tooltiptext").textContent).toEqual(resultTour.testIntros[i-1]);
+       if(i == totalStepsR){
+         expect(document.querySelector(".introjs-donebutton").textContent).toEqual(loc.TOUR_ldone);  
+       }   
+       resultTour.exit();
+     } 
+   });
   });
-}    
-);
+});
diff --git a/dev/js/src/loc/de.js b/dev/js/src/loc/de.js
index 467adc4..2358306 100644
--- a/dev/js/src/loc/de.js
+++ b/dev/js/src/loc/de.js
@@ -58,6 +58,16 @@
   loc.TOUR_seargo = "Suchanfrage starten";
   
   //Guided Tour: explain the result
-  loc.TOUR_result = "Viel Spaß mit KorAP!";
+  loc.TOUR_kwic = "Anzeige des Ergebnisses als KWIC (keyword in context).";
+  loc.TOUR_snippet = "Durch Klicken auf das KWIC kann ein größerer Kontext angezeigt werden.";  
+  loc.TOUR_snippetb = "Anzeige des Snippets";
+  loc.TOUR_metadatab = "Durch die Auswahl des Buttons werden die Metadaten angezeigt.";
+  loc.TOUR_metadata = "Anzeige der Metadaten";
+  loc.TOUR_tokenb = loc.TOUR_tokenb || "Anzeige der Token-Annotationen";
+  loc.TOUR_token = loc.TOUR_token || "KorAP unterstützt multiple Annotationen.";
+  loc.TOUR_treeb = loc.TOUR_tree || "Anzeige weiterer Ansichten"
+  loc.TOUR_tree = loc.TOUR_tree || "Weitere Ansichten können als Baum- oder Bogenansichten angezeigt werden.";
+  loc.TOUR_tourdone = "Viel Spaß mit KorAP!";
+  
   
 });
diff --git a/dev/js/src/tour/tours.js b/dev/js/src/tour/tours.js
index 6ae961c..69d7392 100644
--- a/dev/js/src/tour/tours.js
+++ b/dev/js/src/tour/tours.js
@@ -4,7 +4,8 @@
  * @author Helge Stallkamp
  */
 
-define(['lib/intro', 'vc', 'vc/doc', 'vc/docgroup'], function(introClass, vcClass, docClass, docGroup) {
+
+define(['lib/intro', 'vc', 'hint', 'menu', 'vc/doc', 'vc/docgroup'], function(introClass, vcClass, hintClass, menuClass, docClass, docGroup) {
 
   //needed for localization of labels and contents of the tour
   const loc   = KorAP.Locale;
@@ -28,8 +29,18 @@
   loc.TOUR_help = loc.TOUR_help || "Help and more information about KorAP.";
   loc.TOUR_glimpse = loc.TOUR_glimpse || "Select to show only the first hits in arbitrary order.";
   loc.TOUR_seargo = loc.TOUR_seargo || "Start the search.";
+
   //localization guided Tour gTshowResults
-  loc.TOUR_result = loc.TOUR_result || "Have fun with KorAP!";
+  loc.TOUR_kwic = loc.TOUR_kwic || "KWIC result (keyword in context)";
+  loc.TOUR_snippet = loc.TOUR_snippet ||  "Click on a match to show a larger snippet.";
+  loc.TOUR_snippetb = loc.TOUR_snippetb || "Display of larger snippet";
+  loc.TOUR_metadatab =  loc.TOUR_metadatab || "Click here to display the metadata.";
+  loc.TOUR_metadata = loc.TOUR_metadata || "Metadata";
+  loc.TOUR_tokenb = loc.TOUR_tokenb || "Click here to display the token annotations.";
+  loc.TOUR_token = loc.TOUR_token || "KorAP supports multiple annotations.";
+  loc.TOUR_treeb = loc.TOUR_treeb || "Display further annotations."
+  loc.TOUR_tree = loc.TOUR_tree || "Further annotations can be displayed as tree and arch views."
+  loc.TOUR_tourdone = loc.TOUR_tourdone || "Have fun with KorAP!";
   
   //localization of button labels
   let labelOptions = {
@@ -39,6 +50,8 @@
       'doneLabel': loc.TOUR_ldone,
       'showStepNumbers': false,
   };
+  
+  var doe = document;
 
   return{
 
@@ -51,7 +64,6 @@
       intro.setOption('doneLabel', loc.TOUR_seargo);
      
       //for testing purposes
-      var doe = document;
       if(elparam){
         doe = elparam;
       }
@@ -120,19 +132,9 @@
         ];
 
       //pass in the Steps array created earlier
-      intro.setOptions({steps: Steps});
-
-      //total number of steps, needed for jasmine tests
-      //TODO see also: introJS.totalSteps() merge requested: //github.com/usablica/intro.js/pull/268/files
-      intro.stepCount = Steps.length;
-
-      //array of intro content needed for efficient testing
-      intro.testIntros = [];
-
-      for(let i = 0; i< Steps.length; i++){
-        intro.testIntros.push(Steps[i].intro);
-      }
-
+      intro.setOptions({steps: Steps});      
+      this.testPrerequ(Steps, intro);
+      
       //changes before executing the single steps
       intro.onbeforechange(function(targetedElement){
         switch(targetedElement.id){
@@ -170,7 +172,6 @@
         * completion the gTshowResults Tour. Therefore, the skip-button is removed
         * and the label of the done button changed.
          */
-         
         case "qsubmit":
             intro.setOption('hideNext', true);
           break;
@@ -189,8 +190,6 @@
       intro.oncomplete(function(){
         KorAP.session.set("tour", true);
         doe.getElementById("qsubmit").click();
-        //input.value="";
-        //KorAP._delete.apply(KorAP.vc.root()); 
       });
 
       return intro;
@@ -198,25 +197,136 @@
 
 
     /* Guided Tour to explain the different views of the results */     
-    gTshowResults: function(elparam){  
+    gTshowResults: function(elparam){ 
+      //for testing purposes
       if(elparam){
         doe = elparam;
       }
       let tourR = introClass();
       let StepsSR = [
+        //Step 1, intro_item 0
+        {
+          element: '#search',
+          intro: loc.TOUR_kwic ,
+          position: "auto",
+        },
+        //Step 2, intro_item 1 
+        {
+          element: doe.querySelector("#search > ol > li"),
+          intro: loc.TOUR_snippet,
+          position: "bottom",
+        },
+        //Step 3, intro_item 2 
+        {
+          element: doe.querySelector("#search > ol > li"),
+          intro: loc.TOUR_snippetb,
+          position: "bottom",
+        },
+        //Step 4, intro_item 3
+        {
+          element: doe.querySelector(".action > .metatable"),
+          intro: loc.TOUR_metadatab,
+          position: "bottom",
+        },
+        //Step 5, intro_item 4
+        {
+          element: doe.querySelector(".view.metatable"),
+          intro: loc.TOUR_metadata,
+          position: "auto",
+        },
+        //Step 6, intro_item 5
+        {   
+          element: doe.querySelector(".action > .info"),
+          intro: loc.TOUR_tokenb,
+          position: "bottom",
+        },
+        //Step 7, intro_item 6
+        {   
+          element: doe.querySelector(".view.tokentable"),
+          intro: loc.TOUR_token,
+          position: "auto",
+        },
+        //Step 8, intro_item 7
         {     
-          intro: loc.TOUR_result,
-        }
+          element: doe.querySelector(".tree"),
+          intro: loc.TOUR_treeb,
+          position: "bottom",
+        }, 
+        //Step 9, intro_item 8
+        {     
+          element: doe.querySelector("view.relations"),
+          intro: loc.TOUR_tree,
+          position: "auto",
+        }, 
+        //Step 10, intro_item 9
+        {     
+          intro: loc.TOUR_tourdone, 
+        }    
         ]
-      tourR.setOptions({steps:StepsSR});
-      tourR.setOptions(labelOptions);
       
-      tourR.onbeforechange(function (){ 
+        tourR.setOptions({steps:StepsSR});
+        tourR.setOptions(labelOptions);
+      
+        tourR.onbeforechange(function (){ 
         KorAP.session.set("tour", false);
-      });
+        });
       
+        //See also: https://introjs.com/docs/intro/options/
+        tourR.setOption('scrollToElement', true);
+        tourR.setOption('scrollTo','tooltip');
+        this.testPrerequ(StepsSR, tourR);
+      
+        //TODO see also: introJS.totalSteps() merge requested: //github.com/usablica/intro.js/pull/268/files
+        tourR.onbeforechange(function(targetedElement){
+          
+        if(this._currentStep == 1){
+          KorAP.session.set("tour", false);
+        }
+        
+        if(this._currentStep == 2){
+          doe.querySelector("#search > ol > li").click();
+          tourR._introItems[3].element = doe.querySelector('.action > .metatable');
+          tourR._introItems[3].position = "bottom";
+        }
+  
+        if(this._currentStep == 4){
+          doe.querySelector(".metatable").click();
+          tourR._introItems[4].element = doe.querySelector('.view.metatable');
+          tourR._introItems[5].element = doe.querySelector('.action > .info');
+          tourR._introItems[5].position = "bottom";          
+        }   
+     
+        if(this._currentStep == 6){
+            doe.querySelector(".info").click();
+            tourR._introItems[6].element = doe.querySelector('.view.tokentable');
+            tourR._introItems[7].element = doe.querySelector('.tree');
+            tourR._introItems[7].position = "bottom";
+          }
+      
+        if(this._currentStep == 8){
+          doe.querySelector(".tree").click();
+          document.querySelectorAll(".button-group-list")[0].querySelectorAll('li')[1].click();
+        }
+      });       
+
       return tourR;
     },  
+    /* 
+     * The total number of steps and the text of the tooltips are needed for jasmine testing.
+     */
+    testPrerequ: function(steps, tour){
+      //TODO see also: introJS.totalSteps() merge requested: //github.com/usablica/intro.js/pull/268/files
+      let StepsT = steps;
+      let gtour = tour;      
+      gtour.stepCount = StepsT.length;
+
+      //Array of intro content needed for efficient testing
+      gtour.testIntros = [];
+
+      for(let i = 0; i< StepsT.length; i++){
+      gtour.testIntros.push(StepsT[i].intro);
+      }
+    },
 
   }
 });
