diff --git a/emfforms/public/javascripts/cookieconsent.js b/emfforms/public/javascripts/cookieconsent.js
index dbf367f..db438d9 100644
--- a/emfforms/public/javascripts/cookieconsent.js
+++ b/emfforms/public/javascripts/cookieconsent.js
@@ -24,7 +24,7 @@
       getCookie: function(e) {
         var t = "; " + document.cookie,
           i = t.split("; " + e + "=");
-        return 2 != i.length ? void 0 : i.pop().split(";").shift()
+        return i.length < 2 ? void 0 : i.pop().split(";").shift()
       },
       setCookie: function(e, t, i, o, n) {
         var s = new Date;
@@ -124,7 +124,9 @@
           i = "top" == e.position || "bottom" == e.position ? "banner" : "floating";
         t.isMobile() && (i = "floating");
         var o = ["cc-" + i, "cc-type-" + e.type, "cc-theme-" + e.theme];
-        return e.static && o.push("cc-static"), o.push.apply(o, a.call(this)), h.call(this, this.options.palette), this.customStyleSelector && o.push(this.customStyleSelector), o
+        e.static && o.push("cc-static"), o.push.apply(o, a.call(this));
+        h.call(this, this.options.palette);
+        return this.customStyleSelector && o.push(this.customStyleSelector), o
       }
 
       function l() {
@@ -452,7 +454,8 @@
               url: "//js.maxmind.com/js/apis/geoip2/v2.1/geoip2.js",
               isScript: !0,
               callback: function(e) {
-                return window.geoip2 ? void geoip2.country(function(t) {
+                if (!window.geoip2) return void e(new Error("Unexpected response format. The downloaded script should have exported `geoip2` to the global scope"));
+                geoip2.country(function(t) {
                   try {
                     e({
                       code: t.country.iso_code
@@ -462,7 +465,7 @@
                   }
                 }, function(t) {
                   e(n(t))
-                }) : void e(new Error("Unexpected response format. The downloaded script should have exported `geoip2` to the global scope"))
+                })
               }
             }
           }
@@ -483,7 +486,8 @@
         return "string" == typeof i ? this.options.serviceDefinitions[i]() : t.isPlainObject(i) ? this.options.serviceDefinitions[i.name](i) : null
       }, e.prototype.locate = function(e, t) {
         var i = this.getNextService();
-        return i ? (this.callbackComplete = e, this.callbackError = t, void this.runService(i, this.runNextServiceOnError.bind(this))) : void t(new Error("No services to run"))
+        if (!i) return void t(new Error("No services to run"));
+        this.callbackComplete = e, this.callbackError = t, this.runService(i, this.runNextServiceOnError.bind(this))
       }, e.prototype.setupUrl = function(e) {
         var t = this.getCurrentServiceOpts();
         return e.url.replace(/\{(.*?)\}/g, function(i, o) {
@@ -572,7 +576,7 @@
       i({})
     }, e.utils = t, e.hasInitialised = !0, window.cookieconsent = e
   }
-}(window.cookieconsent || {}), window.cookieconsent.init =  function(onStatusChangeCallback) {
+}(window.cookieconsent || {}),  window.cookieconsent.init =  function(onStatusChangeCallback) {
   window.cookieconsent.Popup.prototype.revokeChoice = function(e) {
     this.options.enabled = !0, this.options.onRevokeChoice.call(this), e || this.autoOpen(), this.open()
   }, window.cookieconsent.Popup.prototype.removeCookies = function() {
@@ -582,25 +586,25 @@
         s = n > -1 ? o.substr(0, n) : o;
       s = s.trim(), void 0 !== e && 0 != e.length && -1 != e.indexOf(s) || (document.cookie = s + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;")
     }
-  },
-    window.cookieconsent.initialise({
+  }, window.cookieconsent.initialise({
     type: "opt-in",
     position: "bottom",
     revokable: !0,
     enabled: !0,
     cookie: {
       name: "eclipse_cookieconsent_status",
-      expiryDays: 90
+      expiryDays: 90,
+      domain: "." + location.hostname.split(".").reverse()[1] + "." + location.hostname.split(".").reverse()[0]
     },
     compliance: {
       "opt-in": '<div class="cc-compliance cc-highlight">{{deny}}{{allow}}</div>'
     },
     onStatusChange: function(e, t) {
-      "allow" !== e && this.removeCookies();
+      document.cookie = "eclipse_cookieconsent_status=" + e + "; expires=0; path=/;", "allow" !== e && this.removeCookies()
       onStatusChangeCallback();
     },
     onInitialise: function(e, t) {
-      setTimeout(function() {
+      console.log(e), setTimeout(function() {
         document.getElementsByClassName("cc-revoke")[0].style.display = "block"
       })
     },
@@ -626,4 +630,4 @@
       message: "Some Eclipse Foundation pages use cookies to better serve you when you return to the site. You can set your browser to notify you before you receive a cookie or turn off cookies. If you do so, however, some areas of some sites may not function properly. To read Eclipse Foundation Privacy Policy"
     }
   })
-};
\ No newline at end of file
+});
\ No newline at end of file
