diff --git a/client/catalog/js/catalog.js b/client/catalog/js/catalog.js
index 5203fdc..2dfb368 100644
--- a/client/catalog/js/catalog.js
+++ b/client/catalog/js/catalog.js
@@ -377,9 +377,9 @@
     } else if (resultIndex === 1) {
       this.resultMenu.find('.previous').removeClass('disabled');
     }
-    $.scrollTo("#results", 500, {
-      interrupt: true
-    });
+    $('body').animate({
+      scrollTop: $("#results").offset().top
+    }, 500);
   }
 
   Atmos.prototype.getResults = function(index) {
@@ -455,19 +455,29 @@
     interest.setInterestLifetimeMilliseconds(500);
     interest.setMustBeFresh(true);
     const face = this.face;
-    async.retry(4, function(done) {
-      face.expressInterest(interest, function(interest, data) {
-        done();
-        success(interest, data);
-      }, function(interest) {
-        done("Interest timed out 4 times.", interest);
+    var cancelled = false;
+    var attempt = 0;
+    openLoadingOverlay(function(update){
+      async.retry(4, function(done) {
+        face.expressInterest(interest, function(interest, data) {
+          update(true, attempt, attempt);
+          done();
+          success(interest, data);
+        }, function(interest) {
+          update(false, attempt++, attempt);
+          done("Timeout", interest);
+        });
+      }, function(err, interest) {
+        update(true, attempt, attempt);
+        if (err) {
+          console.log(err, interest);
+          failure(interest);
+        }
       });
-    }, function(err, interest) {
-      if (err) {
-        console.log(err, interest);
-        failure(interest);
-      }
+    }, function(){
+      cancelled = true;
     });
+
   }
 
   /**
@@ -673,7 +683,8 @@
 
             var item = $('<li><a href="#">' + name + '</a></li>');
             sub.append(item);
-            item.click(function() {
+            item.find('a').click(function(e) {
+              e.preventDefault();
               //Click on the side menu filters
               if (item.hasClass('active')) {
                 //Does the filter already exist?
@@ -685,7 +696,7 @@
                 var filter = $('<span class="label label-default"></span>');
                 filter.text(category + ':' + name);
                 scope.filters.append(filter);
-                filter.click(function() {
+                filter.click(function(e) {
                   //Click on a filter
                   filter.remove();
                   item.removeClass('active');
@@ -694,7 +705,8 @@
             });
           });
           //Toggle the menus. (Only respond when the immediate tab is clicked.)
-          e.find('> a').click(function() {
+          e.find('> a').click(function(e) {
+            e.preventDefault();
             scope.categories.find('.subnav').slideUp();
             var t = $(this).siblings('.subnav');
             if (!t.is(':visible')) {
diff --git a/client/catalog/js/loading-overlay.js b/client/catalog/js/loading-overlay.js
new file mode 100644
index 0000000..849524d
--- /dev/null
+++ b/client/catalog/js/loading-overlay.js
@@ -0,0 +1,78 @@
+/**
+ * This function allows the app to pass in a callback function for updating the progress and a function to call if the progress it cancelled.
+ * @param func - A function accepting two functions as parameters, the first will be called with one parameter (which is a callback function
+ * for progress updates) when the overlay is ready.
+ * @param cancel - A function to call if the overlay is cancelled.
+ *
+ * Example:
+ * openLoadingOverlay(function(update){
+ *   //Begin progress, call update if progress is in chunks, otherwise ignore.
+ * }, function(){
+ *   //Cancelled
+ * });
+ */
+var openLoadingOverlay = (function(){
+  "use strict";
+
+  var isOpen = false;
+
+  return function(func, cancel){
+
+    var overlay = $('#loading');
+    var progress = overlay.find('.progress-bar');
+    var cancelButton = overlay.find('#loading-cancel');
+
+    if (isOpen){
+      console.warn("Two overlays are not permitted at the same time. The second will have dummy callbacks");
+      func(function(){});
+      return;
+    }
+
+    isOpen = true;
+
+    var update = function(done, current, total){
+      if (current && total){
+        progress.text(current + '/' + total)
+        .animate({
+            width: Math.round(current/total) + '%'
+          },
+          200,
+          'linear',
+          function(){
+            if (done){
+              reset();
+            }
+          }
+        );
+      } else {
+        if (done){
+          reset();
+        }
+      }
+    };
+
+    var reset = function(){
+      overlay.modal('hide');
+      progress.text('Loading...').css('width', '100%');
+      overlay.removeClass('cancelled').addClass('loading');
+      cancelButton.removeClass('disabled');
+    };
+
+    cancelButton.one('click', function(){
+
+      cancelButton.addClass('disabled');
+      overlay.addClass('cancelled').removeClass('loading');
+
+      setTimeout(reset, 2000);
+      progress.text('Cancelling...').css('width', 0).animate({
+        width: '100%'
+      }, 2000);
+
+    });
+
+    overlay.modal('show');
+
+    func(update);
+
+  };
+})();
