diff --git a/frontend-js/src/main/js/ServerConnector.js b/frontend-js/src/main/js/ServerConnector.js
index 68da0602930c2bd4d35f522bc9c412a2f11c773b..82c4d0d0d856c150c879479faf597afc57697f0f 100644
--- a/frontend-js/src/main/js/ServerConnector.js
+++ b/frontend-js/src/main/js/ServerConnector.js
@@ -1403,10 +1403,10 @@ ServerConnector.getSessionData = function (project) {
  * @param {number} params.modelId
  * @param {number} [params.projectId]
  * @param {Point} params.coordinates
- * @param {number} params.count
- * @param {string} params.type
+ * @param {number} [params.count]
+ * @param {string} [params.type]
  *
- * @returns {PromiseLike<BioEntity[]>}
+ * @returns {PromiseLike<IdentifiedElement[]>}
  */
 ServerConnector.getClosestElementsByCoordinates = function (params) {
   var self = this;
diff --git a/frontend-js/src/main/js/gui/leftPanel/ChemicalPanel.js b/frontend-js/src/main/js/gui/leftPanel/ChemicalPanel.js
index daff6715ab4bc0fd92fe0102c0a583acfa81254e..579599f37bf08ff04d7f457a460cc08dd3077123 100644
--- a/frontend-js/src/main/js/gui/leftPanel/ChemicalPanel.js
+++ b/frontend-js/src/main/js/gui/leftPanel/ChemicalPanel.js
@@ -28,7 +28,7 @@ function ChemicalPanel(params) {
       "Choose an appropriate MeSH code and provide it in the via the Admin section of this MINERVA platform. " +
       "See User Manual for more details ");
   } else {
-    this.getControlElement(PanelControlElementType.SEARCH_LABEL).innerHTML = "SEARCH FOR TARGETS OF:";
+    self.getControlElement(PanelControlElementType.SEARCH_LABEL).innerHTML = "SEARCH FOR TARGETS OF:";
   }
 }
 
diff --git a/frontend-js/src/main/js/gui/leftPanel/DrugPanel.js b/frontend-js/src/main/js/gui/leftPanel/DrugPanel.js
index f41ef4b34f11402e21e23eb7ffcc982e39004f29..ee96cfe765e6810c7b0c462c661f0e075dcdabf3 100644
--- a/frontend-js/src/main/js/gui/leftPanel/DrugPanel.js
+++ b/frontend-js/src/main/js/gui/leftPanel/DrugPanel.js
@@ -22,7 +22,8 @@ function DrugPanel(params) {
   params.placeholder = "drug, synonym, brand name";
 
   AbstractDbPanel.call(this, params);
-  this.getControlElement(PanelControlElementType.SEARCH_LABEL).innerHTML = "SEARCH FOR TARGETS OF:";
+  var self = this;
+  self.getControlElement(PanelControlElementType.SEARCH_LABEL).innerHTML = "SEARCH FOR TARGETS OF:";
 }
 
 DrugPanel.prototype = Object.create(AbstractDbPanel.prototype);
diff --git a/frontend-js/src/main/js/map/AbstractCustomMap.js b/frontend-js/src/main/js/map/AbstractCustomMap.js
index 1e9b6aeb682cfad34e265f3fc260f044ab50da2a..c9d547fbb0ac606478bc8a1df0622b41607776b2 100644
--- a/frontend-js/src/main/js/map/AbstractCustomMap.js
+++ b/frontend-js/src/main/js/map/AbstractCustomMap.js
@@ -45,6 +45,7 @@ function AbstractCustomMap(model, options) {
   this.setElement(options.getElement());
   this.setConfiguration(options.getConfiguration());
   this.setProject(options.getProject());
+  this.setServerConnector(options.getServerConnector());
 
   this.setModel(model);
 
@@ -92,7 +93,7 @@ AbstractCustomMap.prototype.getMarkerSurfaceCollection = function () {
 AbstractCustomMap.prototype.createMapOptions = function () {
   var self = this;
   var model = self.getModel();
-  var zoom = ServerConnector.getSessionData(self.getProject()).getZoomLevel(model);
+  var zoom = self.getServerConnector().getSessionData(self.getProject()).getZoomLevel(model);
   if (zoom === undefined) {
     zoom = model.getDefaultZoomLevel();
   }
@@ -100,7 +101,7 @@ AbstractCustomMap.prototype.createMapOptions = function () {
     zoom = self.getMinZoom();
   }
 
-  var point = ServerConnector.getSessionData(self.getProject()).getCenter(model);
+  var point = self.getServerConnector().getSessionData(self.getProject()).getCenter(model);
   if (point === undefined) {
     var x = model.getDefaultCenterX();
     var y = model.getDefaultCenterY();
@@ -238,7 +239,7 @@ AbstractCustomMap.prototype.registerMapClickEvents = function () {
  */
 function activateMolStarLink(coordinates, map) {
 
-  return ServerConnector.getClosestElementsByCoordinates({
+  return map.getServerConnector().getClosestElementsByCoordinates({
     modelId: map.getId(),
     coordinates: coordinates,
     count: 1
@@ -641,7 +642,7 @@ AbstractCustomMap.prototype.setConfiguration = function (configuration) {
 
 AbstractCustomMap.prototype._createMapChangedCallbacks = function () {
   var self = this;
-  var sessionData = ServerConnector.getSessionData(self.getTopMap().getProject());
+  var sessionData = self.getServerConnector().getSessionData(self.getTopMap().getProject());
   // listener for changing zoom level
   this.getMapCanvas().addListener('zoom_changed', function () {
     sessionData.setZoomLevel(self.getModel(), self.getZoom());
@@ -968,6 +969,22 @@ AbstractCustomMap.prototype.getProject = function () {
   return this._project;
 };
 
+/**
+ *
+ * @param {ServerConnector} serverConnector
+ */
+AbstractCustomMap.prototype.setServerConnector = function (serverConnector) {
+  this._serverConnector = serverConnector;
+};
+
+/**
+ *
+ * @returns {ServerConnector}
+ */
+AbstractCustomMap.prototype.getServerConnector = function () {
+  return this._serverConnector;
+};
+
 AbstractCustomMap.prototype.destroy = function () {
   $(this.getElement()).off("touchstart");
 };
diff --git a/frontend-js/src/main/js/map/CustomMap.js b/frontend-js/src/main/js/map/CustomMap.js
index 2d6db63d2b6955af99c3baa2c1a1e21451105999..f2989dc1a5b750fbb098b9664ff09425ed5a28f1 100644
--- a/frontend-js/src/main/js/map/CustomMap.js
+++ b/frontend-js/src/main/js/map/CustomMap.js
@@ -85,7 +85,7 @@ CustomMap.prototype.constructor = CustomMap;
  */
 CustomMap.prototype.init = function () {
   var self = this;
-  var sessionData = ServerConnector.getSessionData(self.getProject());
+  var sessionData = self.getServerConnector().getSessionData(self.getProject());
 
   // if we have background overlay stored in the session then restore it
   var mapType = sessionData.getSelectedBackgroundOverlay();
@@ -107,7 +107,7 @@ CustomMap.prototype.init = function () {
       }
     }
   }).then(function () {
-    return ServerConnector.getLogoImg();
+    return self.getServerConnector().getLogoImg();
   }).then(function (url) {
     var logo2 = self.getControl(ControlType.LOGO_2_IMG);
     if (!/^(f|ht)tps?:\/\//i.test(url)) {
@@ -131,13 +131,14 @@ CustomMap.prototype.createSubmaps = function () {
  * Creates logo and put it on the google map.
  */
 CustomMap.prototype.createLogo = function () {
+  var self = this;
   var logoControlDiv2 = Functions.createElement({type: "div", index: 0});
   var logo2 = Functions.createElement({
     type: 'IMG',
     style: "cursor: pointer; width: 80px",
     id: ControlType.LOGO_2_IMG,
     onclick: function () {
-      return ServerConnector.getLogoLink().then(function (url) {
+      return self.getServerConnector().getLogoLink().then(function (url) {
         var win = window.open(url, '_blank');
         win.focus();
       }).catch(GuiConnector.alert);
@@ -226,7 +227,7 @@ CustomMap.prototype.openDataOverlay = function (param) {
             for (var i = 0; i < visibleDataOverlays.length; i++) {
               ids.push(visibleDataOverlays[i].getId());
             }
-            ServerConnector.getSessionData(self.getProject()).setVisibleOverlays(ids);
+            self.getServerConnector().getSessionData(self.getProject()).setVisibleOverlays(ids);
             return self.redrawSelectedDataOverlays();
           }).then(function () {
             var backgroundToOpen;
@@ -341,7 +342,7 @@ CustomMap.prototype.refreshComments = function () {
 
   var commentDbOverlay = self.getOverlayByName("comment");
   if (commentDbOverlay !== undefined) {
-    if (ServerConnector.getSessionData(self.getProject()).getShowComments()) {
+    if (self.getServerConnector().getSessionData(self.getProject()).getShowComments()) {
       return commentDbOverlay.refresh();
     } else {
       return commentDbOverlay.clear();
@@ -484,7 +485,7 @@ CustomMap.prototype.customizeGoogleMapView = function (div) {
   var x = self.getModel().getDefaultCenterX();
   var y = self.getModel().getDefaultCenterY();
   var zoom = self.getModel().getDefaultZoomLevel();
-  if (ServerConnector.getSessionData(self.getProject()).getCenter(self.getModel()) === undefined &&
+  if (self.getServerConnector().getSessionData(self.getProject()).getCenter(self.getModel()) === undefined &&
     (x === undefined || y === undefined || zoom === undefined ||
       x === null || y === null || zoom === null
     )) {
@@ -503,7 +504,7 @@ CustomMap.prototype.customizeGoogleMapView = function (div) {
 CustomMap.prototype.createMapChangedCallbacks = function () {
   this._createMapChangedCallbacks();
   var self = this;
-  var sessionData = ServerConnector.getSessionData(self.getProject());
+  var sessionData = self.getServerConnector().getSessionData(self.getProject());
 
   // listener for changing type of background overlay
   // noinspection SpellCheckingInspection
@@ -570,7 +571,7 @@ CustomMap.prototype.hideDataOverlay = function (identifier) {
       for (var i = 0; i < visibleDataOverlays.length; i++) {
         ids.push(visibleDataOverlays[i].getId());
       }
-      ServerConnector.getSessionData(self.getProject()).setVisibleOverlays(ids);
+      self.getServerConnector().getSessionData(self.getProject()).setVisibleOverlays(ids);
       return self.redrawSelectedDataOverlays();
     }).then(function () {
       return self.getProject().getDataOverlayById(identifier);
@@ -1018,7 +1019,7 @@ CustomMap.prototype.getReferenceGenome = function (type, version) {
     self._referenceGenome[type] = [];
   }
   if (self._referenceGenome[type][version] === undefined) {
-    return ServerConnector.getReferenceGenome({
+    return self.getServerConnector().getReferenceGenome({
       type: type,
       version: version,
       organism: self.getProject().getOrganism().getResource()
@@ -1119,7 +1120,7 @@ CustomMap.prototype.getSelectionContextMenu = function () {
  */
 CustomMap.prototype.openCommentDialog = function () {
   var self = this;
-  return ServerConnector.getClosestElementsByCoordinates({
+  return self.getServerConnector().getClosestElementsByCoordinates({
     modelId: this.getActiveSubmapId(),
     coordinates: this.getActiveSubmapClickCoordinates()
   }).then(function (elements) {
diff --git a/frontend-js/src/main/js/map/CustomMapOptions.js b/frontend-js/src/main/js/map/CustomMapOptions.js
index 0c57bb21a4978e1d090f25ec68ac1a31f04b9d7c..e992f2a2e7237dce44b26653de114abe9e2ce35f 100644
--- a/frontend-js/src/main/js/map/CustomMapOptions.js
+++ b/frontend-js/src/main/js/map/CustomMapOptions.js
@@ -5,6 +5,18 @@ var logger = require('./../logger');
 /**
  * Object representing information needed for constructing {@link CustomMap}
  * objects.
+ *
+ * @param {Object|CustomMapOptions} params
+ * @param {HTMLElement} params.element
+ * @param {Configuration} params.configuration
+ * @param {Project} [params.project]
+ * @param {string} params.projectId
+ * @param {ServerConnector} params.serverConnector
+ * @param {boolean} [params.bigLogo]
+ * @param {boolean} [params.debug]
+ * @param {Object} [params.plugins]
+ *
+ * @constructor
  */
 function CustomMapOptions(params) {
   if (params.element === undefined) {
@@ -14,6 +26,7 @@ function CustomMapOptions(params) {
   this.setConfiguration(params.configuration);
   this.setProject(params.project);
   this.setProjectId(params.projectId);
+  this.setServerConnector(params.serverConnector);
 
   if (params.bigLogo !== undefined) {
     if (typeof params.bigLogo === "boolean") {
@@ -55,6 +68,22 @@ CustomMapOptions.prototype.setProject = function (project) {
   this._project = project;
 };
 
+/**
+ *
+ * @returns {ServerConnector}
+ */
+CustomMapOptions.prototype.getServerConnector = function () {
+  return this._serverConnector;
+};
+
+/**
+ *
+ * @param {ServerConnector} serverConnector
+ */
+CustomMapOptions.prototype.setServerConnector = function (serverConnector) {
+  this._serverConnector = serverConnector;
+};
+
 CustomMapOptions.prototype.getPlugins = function () {
   return this._plugins;
 };
diff --git a/frontend-js/src/main/js/map/Submap.js b/frontend-js/src/main/js/map/Submap.js
index fec5c2b175d5aedd5fccbc2797c02c1fcfc6aa5c..13ec12a02c2fde4c7d68740cb5791da56f143aa4 100644
--- a/frontend-js/src/main/js/map/Submap.js
+++ b/frontend-js/src/main/js/map/Submap.js
@@ -25,7 +25,8 @@ function Submap(customMap, model) {
     element: customMap.getElement(),
     bigLogo: customMap.isBigLogo(),
     project: null,
-    debug: customMap.isDebug()
+    debug: customMap.isDebug(),
+    serverConnector: customMap.getServerConnector()
   }));
 
   this.initialized = false;
diff --git a/frontend-js/src/main/js/minerva.js b/frontend-js/src/main/js/minerva.js
index 57afada15ab4c45bf1b3ca03169e83168662136d..5ea1711372f52923b202bb3a5df42e30b7688065 100644
--- a/frontend-js/src/main/js/minerva.js
+++ b/frontend-js/src/main/js/minerva.js
@@ -240,6 +240,7 @@ function create(params) {
   if (!(params instanceof CustomMapOptions)) {
     params = new CustomMapOptions(params);
   }
+  params.setServerConnector(ServerConnector);
   initGlobals(params);
   params.getElement().style.display = "table";
   params.getElement().innerHTML = "<div style='vertical-align:middle;display:table-cell;text-align: center'>"
diff --git a/frontend-js/src/test/js/gui/OverviewDialog-test.js b/frontend-js/src/test/js/gui/OverviewDialog-test.js
index bde482dc83bd8e8d8584775836ff0831ac369ae0..8b4480f8e6acf2120be5c82949d94e3453fb323b 100644
--- a/frontend-js/src/test/js/gui/OverviewDialog-test.js
+++ b/frontend-js/src/test/js/gui/OverviewDialog-test.js
@@ -15,8 +15,7 @@ describe('OverviewDialog', function () {
   it('open image', function () {
     helper.setUrl("http://test/?id=complex_model_with_images");
     return ServerConnector.getProject().then(function (project) {
-      var options = helper.createOptions(project);
-      var map = new CustomMap(options);
+      var map = helper.createCustomMap(project);
 
       var dialog = new OverviewDialog({
         element: testDiv,
@@ -31,8 +30,7 @@ describe('OverviewDialog', function () {
   it('open invalid image', function () {
     helper.setUrl("http://test/?id=complex_model_with_images");
     return ServerConnector.getProject().then(function (project) {
-      var options = helper.createOptions(project);
-      var map = new CustomMap(options);
+      var map = helper.createCustomMap(project);
 
       var dialog = new OverviewDialog({
         element: testDiv,
diff --git a/frontend-js/src/test/js/helper.js b/frontend-js/src/test/js/helper.js
index 8ce42ecdcf5c4b3d69c2dcdadbee77f9acce76ec..bb886842375a076532515e8536e94d5b89f3d109 100644
--- a/frontend-js/src/test/js/helper.js
+++ b/frontend-js/src/test/js/helper.js
@@ -328,18 +328,10 @@ Helper.prototype.createReaction = function (map, complete) {
   return result;
 };
 
-Helper.prototype.createOptions = function (project) {
-  if (project === undefined) {
-    project = this.createProject();
-  }
-
-  return {
-    mapDiv: testDiv,
-    element: testDiv,
-    project: project
-  };
-};
-
+/**
+ *
+ * @returns {MapModel}
+ */
 Helper.prototype.createModel = function () {
   var result = new Model();
   result.setId(this.idCounter++);
@@ -369,6 +361,11 @@ Helper.prototype.createOverlay = function (model) {
   });
 };
 
+/**
+ *
+ * @param {Project} [project]
+ * @returns {CustomMapOptions}
+ */
 Helper.prototype.createCustomMapOptions = function (project) {
   if (project === undefined) {
     project = this.createProject();
@@ -378,7 +375,8 @@ Helper.prototype.createCustomMapOptions = function (project) {
     project: project,
     element: testDiv,
     mapDiv: testDiv,
-    configuration: this.getConfiguration()
+    configuration: this.getConfiguration(),
+    serverConnector: ServerConnector
   });
 
 };
diff --git a/frontend-js/src/test/js/map/CustomMap-test.js b/frontend-js/src/test/js/map/CustomMap-test.js
index f5600552d5abd2e2273ce1add4e100d595d20757..231b15f5b1f5f6dc87f48c45781e403a4c8dd39b 100644
--- a/frontend-js/src/test/js/map/CustomMap-test.js
+++ b/frontend-js/src/test/js/map/CustomMap-test.js
@@ -199,7 +199,8 @@ describe('CustomMap', function () {
         assert.ok(map.selectedLayoutOverlays[layout.getId()][1] instanceof ReactionSurface);
 
         // now hide the layout
-        map._hideSelectedLayout(layout.getId());
+        return map._hideSelectedLayout(layout.getId());
+      }).then(function () {
         assert.ok(map.selectedLayoutOverlays[layout.getId()]);
         assert.equal(0, map.selectedLayoutOverlays[layout.getId()].length);
       });
@@ -233,7 +234,9 @@ describe('CustomMap', function () {
           assert.equal(0, emptySubmap.selectedLayoutOverlays[overlayId].length);
 
           // now hide the layout
-          customMap.hideSelectedLayout(overlayId);
+
+          return customMap.hideSelectedLayout(overlayId);
+        }).then(function () {
           assert.equal(0, customMap.selectedLayoutOverlays[overlayId].length);
           assert.equal(0, filledSubmap.selectedLayoutOverlays[overlayId].length);
           assert.equal(0, emptySubmap.selectedLayoutOverlays[overlayId].length);
diff --git a/frontend-js/src/test/js/minerva-test.js b/frontend-js/src/test/js/minerva-test.js
index 1c33cb48beb5dd3228697c83469ac4efe3e4a681..48bdb5c1e3d6741f9c7eb0add03f950161db0e7e 100644
--- a/frontend-js/src/test/js/minerva-test.js
+++ b/frontend-js/src/test/js/minerva-test.js
@@ -51,7 +51,7 @@ describe('minerva global', function () {
       helper.setUrl("http://test/?id=complex_model_with_images");
       var customMap;
       return ServerConnectorMock.getProject().then(function (project) {
-        var options = helper.createOptions(project);
+        var options = helper.createCustomMapOptions(project);
 
         return minerva.create(options);
       }).then(function (result) {
diff --git a/frontend-js/src/test/js/mocha-config.js b/frontend-js/src/test/js/mocha-config.js
index 27d5e2275c7566afcf5a0262912d4ba2488e770e..c1b8448957c0aa9503d767d7c089570e1bb7e568 100644
--- a/frontend-js/src/test/js/mocha-config.js
+++ b/frontend-js/src/test/js/mocha-config.js
@@ -210,6 +210,7 @@ beforeEach(function () {
   ServerConnector.getSessionData(null).setLogin("anonymous");
 
 
+  // @type HTMLElement
   global.testDiv = document.createElement("div");
   global.testDiv.id = "test";
   document.body.appendChild(testDiv);