diff --git a/templates/index.html.ep b/templates/index.html.ep
index 4745c90..32c8a07 100644
--- a/templates/index.html.ep
+++ b/templates/index.html.ep
@@ -123,7 +123,7 @@
            nranks = nranks.concat(paraResults[i].map(function(a){return a.rank;}));
            nmarked = nmarked.concat(paraResults[i].map(function(a){return a.marked;}));
          }
-         showMap({target: " "+urlParams.get('word')+" ", mergedEnd: 0, words: nwords, vecs: nvecs, ranks: nranks, marked: nmarked} );
+         showMap({target: " "+urlParams.get('word')+" ", mergedEnd: <%= $mergedEnd %>, words: nwords, vecs: nvecs, ranks: nranks, marked: nmarked} );
          var t = $('#firsttable').DataTable({
            data: paraResults[0],
            "sScrollY": "780px",
@@ -139,7 +139,9 @@
            "columns": [
              { "data": "rank", type: "allnumeric" },
              { "data": "dist",  render: function ( data, type, row ) {return data.toFixed(3) }},
-             { "data": "word",  class: "paradigmator", render: function ( data, type, row ) {urlprefix.set("word", data); return  '<a href="?' + urlprefix + '">' + data + '</a>' }}
+             { "data": "word",  class: "paradigmator", render: function ( data, type, row ) {
+               urlprefix.set("word", data); return  '<a class="' + getMergedClass(row.rank) + '" href="?' + urlprefix + '">' + data + '</a>' 
+             }}
            ],
            "columnDefs": [
              { className: "dt-right", "targets": [0,1] },
@@ -498,6 +500,26 @@
      var anchor_array = [];
      var text;
 
+     function getMergedClass(i) {
+       if(data.mergedEnd && i > data.mergedEnd) {
+         return " merged"
+       } else {
+         return "";
+       }
+     }
+
+     function getRankTooltip(i) {
+       if(data.mergedEnd) {
+         if(data.ranks[i] < data.mergedEnd) {
+           return "rank: "+i +"  "+"freq. rank: "+(data.ranks[i]).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
+         } else {
+           return "rank: "+i +"  "+"freq. rank: "+(data.ranks[i]-data.mergedEnd).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + " (merged vocab)";
+         }
+       } else {
+         return "rank: "+i +"  "+"freq. rank: "+data.ranks[i].toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
+       }
+     }
+
      function drawEmbedding() {
        var urlprefix =  new URLSearchParams(window.location.search);
        urlprefix.delete("word");
@@ -527,23 +549,16 @@
             res="marked ";
           }
           if(data.target.indexOf(" "+d+" ") >= 0) {
-            return res+"target";
-          } else if(data.ranks[i] < data.mergedEnd) {
-            return res+"merged";
+            res += "target";
+          } 
+          if(data.mergedEnd && data.ranks[i] >= data.mergedEnd) {
+            return res+" merged";
           } else {
             return res;
           }
         })
         .attr("title", function(d, i) {
-          if(data.mergedEnd > 0) {
-            if(data.ranks[i] >= data.mergedEnd) {
-              return "rank: "+i +"  "+"freq. rank: "+(data.ranks[i]).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
-            } else {
-              return "rank: "+i +"  "+"freq. rank: "+data.ranks[i].toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + " (merged vocab)";
-            }
-          } else {
-            return "rank: "+i +"  "+"freq. rank: "+data.ranks[i].toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
-          }
+          return getRankTooltip(i);
         })
         .append("text")
         .attr("text-anchor", "top")
@@ -552,7 +567,7 @@
 
        g.append("svg:title")
         .text(function(d, i) {
-		      return "distance rank: "+ i +"  "+"\nfrequency rank: "+data.ranks[i].toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
+		      return getRankTooltip(i);
 	      });
 
        var zoomListener = d3.behavior.zoom()
@@ -674,7 +689,7 @@
          $.post('/derekovecs/getVecsByRanks',
                 JSON.stringify(nranks),
                 function(data, status){
-                  showMap({target: " "+urlParams.get('word')+" ", mergedEnd: 0, words: nwords, vecs: data, ranks: nranks, marked: Array(100).fill(false)} );
+                  showMap({target: " "+urlParams.get('word')+" ", mergedEnd: <%= $mergedEnd %>, words: nwords, vecs: data, ranks: nranks, marked: Array(100).fill(false)} );
                 }, 'json');
        }
      }
