diff --git a/resources/static/communication_iframe/iframe.js b/resources/static/communication_iframe/iframe.js
index 57e7080cd69f5425faec910c4901ba54dc2e3a25..57409c9f1dbd86205a38acfd6b8df38a1aad2d23 100644
--- a/resources/static/communication_iframe/iframe.js
+++ b/resources/static/communication_iframe/iframe.js
@@ -41,19 +41,19 @@ window.console = window.console || {
 
 steal
   .plugins('jquery')
-  .then('../dialog/resources/jschannel',
-        '../dialog/resources/base64',
-        '../dialog/resources/underscore-min',
-        '../dialog/resources/channel',
-        '../dialog/resources/browserid',
-        '../dialog/resources/storage',
-        '../dialog/resources/tooltip',
-        '../dialog/resources/validation',
-        '../dialog/resources/browserid-extensions',
-        '../dialog/resources/network',
-        '../dialog/resources/user',
-        '../dialog/resources/error-messages',
-        '../dialog/resources/wait-messages',
+  .then('../lib/jschannel',
+        '../lib/base64',
+        '../lib/underscore-min',
+        '../resources/channel',
+        '../resources/browserid',
+        '../resources/storage',
+        '../resources/tooltip',
+        '../resources/validation',
+        '../resources/browserid-extensions',
+        '../resources/network',
+        '../resources/user',
+        '../resources/error-messages',
+        '../resources/wait-messages',
         afterResourceLoad);
 
 function afterResourceLoad() {
diff --git a/resources/static/dialog/dialog.js b/resources/static/dialog/dialog.js
index c141b8f060929fc5130b8cc6e65404b9b1ee24be..1270aee6fab8ff0cc3ce3cb5e9d5ffbc204e5338 100644
--- a/resources/static/dialog/dialog.js
+++ b/resources/static/dialog/dialog.js
@@ -39,26 +39,30 @@ window.console = window.console || {
   log: function() {}
 };
 
-steal.plugins(
-	'jquery/controller',			// a widget factory
-	'jquery/controller/subscribe')	// subscribe to OpenAjax.hub
+steal(
+              '../lib/jschannel',
+              '../lib/base64',
+              '../lib/underscore-min',
+              '../lib/ejs',
+              '../resources/browserid',
+              '../lib/jquery-1.6.2.min.js',
+              '../lib/dom-jquery')
+  .plugins(
+              'jquery/controller',			// a widget factory
+              'jquery/controller/subscribe')	// subscribe to OpenAjax.hub
 
-	.resources('jschannel',
-               'base64',
-               'underscore-min',
-               'channel',
-               'ejs',
-               'browserid',
-               'dom-jquery',
-               'storage',
-               'tooltip',
-               'validation',
-               'browser-support',
-               'browserid-extensions',
-               'network',
-               'user',
-               'error-messages',
-               'wait-messages')					// 3rd party script's (like jQueryUI), in resources folder
+	.resources(
+               'channel')
+  .then(
+               '../resources/storage',
+               '../resources/tooltip',
+               '../resources/validation',
+               '../resources/browser-support',
+               '../resources/browserid-extensions',
+               '../resources/network',
+               '../resources/user',
+               '../resources/error-messages',
+               '../resources/wait-messages')					// 3rd party script's (like jQueryUI), in resources folder
 
 	.controllers('page',
                'dialog',
@@ -66,15 +70,7 @@ steal.plugins(
                'checkregistration',
                'pickemail')					// loads files in controllers folder
 
-/*	.views('authenticate.ejs',
-           'confirmemail.ejs',
-           'pickemail.ejs',
-           'wait.ejs',
-           'error.ejs',
-           'offline.ejs'
-          ).
-*/
-          .then(function() {
+  .then(function() {
             $(function() {
               $('body').dialog().show();
             });
diff --git a/resources/static/dialog/resources/base64.js b/resources/static/lib/base64.js
similarity index 100%
rename from resources/static/dialog/resources/base64.js
rename to resources/static/lib/base64.js
diff --git a/resources/static/dialog/resources/dom-jquery.js b/resources/static/lib/dom-jquery.js
similarity index 100%
rename from resources/static/dialog/resources/dom-jquery.js
rename to resources/static/lib/dom-jquery.js
diff --git a/resources/static/dialog/resources/ejs.js b/resources/static/lib/ejs.js
similarity index 100%
rename from resources/static/dialog/resources/ejs.js
rename to resources/static/lib/ejs.js
diff --git a/resources/static/js/highlight.js b/resources/static/lib/highlight.js
similarity index 100%
rename from resources/static/js/highlight.js
rename to resources/static/lib/highlight.js
diff --git a/resources/static/js/html5shim.js b/resources/static/lib/html5shim.js
similarity index 100%
rename from resources/static/js/html5shim.js
rename to resources/static/lib/html5shim.js
diff --git a/resources/static/js/jquery-1.6.2.min.js b/resources/static/lib/jquery-1.6.2.min.js
similarity index 100%
rename from resources/static/js/jquery-1.6.2.min.js
rename to resources/static/lib/jquery-1.6.2.min.js
diff --git a/resources/static/dialog/resources/jschannel.js b/resources/static/lib/jschannel.js
similarity index 100%
rename from resources/static/dialog/resources/jschannel.js
rename to resources/static/lib/jschannel.js
diff --git a/resources/static/js/json2.js b/resources/static/lib/json2.js
similarity index 100%
rename from resources/static/js/json2.js
rename to resources/static/lib/json2.js
diff --git a/resources/static/dialog/resources/underscore-min.js b/resources/static/lib/underscore-min.js
similarity index 100%
rename from resources/static/dialog/resources/underscore-min.js
rename to resources/static/lib/underscore-min.js
diff --git a/resources/static/js/pages/add_email_address.js b/resources/static/pages/add_email_address.js
similarity index 100%
rename from resources/static/js/pages/add_email_address.js
rename to resources/static/pages/add_email_address.js
diff --git a/resources/static/js/browserid.js b/resources/static/pages/browserid.js
similarity index 100%
rename from resources/static/js/browserid.js
rename to resources/static/pages/browserid.js
diff --git a/resources/static/js/pages/forgot.js b/resources/static/pages/forgot.js
similarity index 100%
rename from resources/static/js/pages/forgot.js
rename to resources/static/pages/forgot.js
diff --git a/resources/static/js/pages/index.js b/resources/static/pages/index.js
similarity index 100%
rename from resources/static/js/pages/index.js
rename to resources/static/pages/index.js
diff --git a/resources/static/js/pages/manage_account.js b/resources/static/pages/manage_account.js
similarity index 100%
rename from resources/static/js/pages/manage_account.js
rename to resources/static/pages/manage_account.js
diff --git a/resources/static/js/page_helpers.js b/resources/static/pages/page_helpers.js
similarity index 100%
rename from resources/static/js/page_helpers.js
rename to resources/static/pages/page_helpers.js
diff --git a/resources/static/js/pages/signin.js b/resources/static/pages/signin.js
similarity index 100%
rename from resources/static/js/pages/signin.js
rename to resources/static/pages/signin.js
diff --git a/resources/static/js/pages/signup.js b/resources/static/pages/signup.js
similarity index 100%
rename from resources/static/js/pages/signup.js
rename to resources/static/pages/signup.js
diff --git a/resources/static/js/pages/verify_email_address.js b/resources/static/pages/verify_email_address.js
similarity index 100%
rename from resources/static/js/pages/verify_email_address.js
rename to resources/static/pages/verify_email_address.js
diff --git a/resources/static/dialog/resources/browser-support.js b/resources/static/resources/browser-support.js
similarity index 100%
rename from resources/static/dialog/resources/browser-support.js
rename to resources/static/resources/browser-support.js
diff --git a/resources/static/dialog/resources/browserid-extensions.js b/resources/static/resources/browserid-extensions.js
similarity index 100%
rename from resources/static/dialog/resources/browserid-extensions.js
rename to resources/static/resources/browserid-extensions.js
diff --git a/resources/static/dialog/resources/browserid.js b/resources/static/resources/browserid.js
similarity index 100%
rename from resources/static/dialog/resources/browserid.js
rename to resources/static/resources/browserid.js
diff --git a/resources/static/dialog/resources/error-display.js b/resources/static/resources/error-display.js
similarity index 100%
rename from resources/static/dialog/resources/error-display.js
rename to resources/static/resources/error-display.js
diff --git a/resources/static/dialog/resources/error-messages.js b/resources/static/resources/error-messages.js
similarity index 100%
rename from resources/static/dialog/resources/error-messages.js
rename to resources/static/resources/error-messages.js
diff --git a/resources/static/dialog/resources/network.js b/resources/static/resources/network.js
similarity index 100%
rename from resources/static/dialog/resources/network.js
rename to resources/static/resources/network.js
diff --git a/resources/static/dialog/resources/storage.js b/resources/static/resources/storage.js
similarity index 100%
rename from resources/static/dialog/resources/storage.js
rename to resources/static/resources/storage.js
diff --git a/resources/static/dialog/resources/tooltip.js b/resources/static/resources/tooltip.js
similarity index 100%
rename from resources/static/dialog/resources/tooltip.js
rename to resources/static/resources/tooltip.js
diff --git a/resources/static/dialog/resources/user.js b/resources/static/resources/user.js
similarity index 100%
rename from resources/static/dialog/resources/user.js
rename to resources/static/resources/user.js
diff --git a/resources/static/dialog/resources/validation.js b/resources/static/resources/validation.js
similarity index 100%
rename from resources/static/dialog/resources/validation.js
rename to resources/static/resources/validation.js
diff --git a/resources/static/dialog/resources/wait-messages.js b/resources/static/resources/wait-messages.js
similarity index 100%
rename from resources/static/dialog/resources/wait-messages.js
rename to resources/static/resources/wait-messages.js
diff --git a/resources/static/dialog/funcunit.html b/resources/static/test/funcunit.html
similarity index 100%
rename from resources/static/dialog/funcunit.html
rename to resources/static/test/funcunit.html
diff --git a/resources/static/test/qunit/controllers/authenticate_controller_unit_test.js b/resources/static/test/qunit/controllers/authenticate_controller_unit_test.js
index 5358636ef39ca95d239ae1f9f3a703f9f66ec90f..2d0aa6964367f369a72f89ebc783471f301d311c 100644
--- a/resources/static/test/qunit/controllers/authenticate_controller_unit_test.js
+++ b/resources/static/test/qunit/controllers/authenticate_controller_unit_test.js
@@ -34,10 +34,10 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
-steal.plugins("jquery").then("/test/qunit/mocks/xhr", "/dialog/resources/network", "/dialog/controllers/page_controller", "/dialog/controllers/authenticate_controller", function() {
+steal.plugins("jquery").then("/test/qunit/mocks/xhr", "/resources/network", "/dialog/controllers/page_controller", "/dialog/controllers/authenticate_controller", function() {
   "use strict";
 
-  var controller, 
+  var controller,
       el = $("body"),
       bid = BrowserID,
       storage = bid.Storage,
@@ -80,11 +80,11 @@ steal.plugins("jquery").then("/test/qunit/mocks/xhr", "/dialog/resources/network
         } catch(e) {
           // may already be destroyed from close inside of the controller.
         }
-      }    
+      }
       reset();
       storage.clear();
       network.setXHR($);
-    } 
+    }
   });
 
   test("setting email address prefills address field", function() {
diff --git a/resources/static/test/qunit/pages/add_email_address_test.js b/resources/static/test/qunit/pages/add_email_address_test.js
index 93d1863ed3eb89e23eefa38b1bbacc215ae9582a..4a4c4ed737f857a4c6918856d78cd3f7bd67bebf 100644
--- a/resources/static/test/qunit/pages/add_email_address_test.js
+++ b/resources/static/test/qunit/pages/add_email_address_test.js
@@ -34,7 +34,7 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
-steal.plugins("jquery").then("/dialog/resources/network", "/js/pages/add_email_address", function() {
+steal.plugins("jquery").then("/resources/network", "/pages/add_email_address", function() {
   "use strict";
 
   var bid = BrowserID,
@@ -42,16 +42,16 @@ steal.plugins("jquery").then("/dialog/resources/network", "/js/pages/add_email_a
       storage = bid.Storage,
       xhr = bid.Mocks.xhr,
       validToken = true;
-  
+
   module("pages/add_email_address", {
     setup: function() {
-      network.setXHR(xhr);  
+      network.setXHR(xhr);
       xhr.useResult("valid");
       $(".error").stop().hide();
       $(".website").text("");
     },
     teardown: function() {
-      network.setXHR($);  
+      network.setXHR($);
       $(".error").stop().hide();
       $(".website").text("");
     }
@@ -61,7 +61,7 @@ steal.plugins("jquery").then("/dialog/resources/network", "/js/pages/add_email_a
     storage.setStagedOnBehalfOf("browserid.org");
 
     bid.addEmailAddress("token");
-    
+
     setTimeout(function() {
       equal($("#email").text(), "testuser@testuser.com", "email set");
       ok($(".siteinfo").is(":visible"), "siteinfo is visible when we say what it is");
@@ -73,7 +73,7 @@ steal.plugins("jquery").then("/dialog/resources/network", "/js/pages/add_email_a
 
   test("addEmailAddress with good token and nosite", function() {
     bid.addEmailAddress("token");
-    
+
     setTimeout(function() {
       equal($("#email").text(), "testuser@testuser.com", "email set");
       equal($(".siteinfo").is(":visible"), false, "siteinfo is not visible without having it");
diff --git a/resources/static/test/qunit/js/browserid_unit_test.js b/resources/static/test/qunit/pages/browserid_unit_test.js
similarity index 93%
rename from resources/static/test/qunit/js/browserid_unit_test.js
rename to resources/static/test/qunit/pages/browserid_unit_test.js
index 840039df59b43dd36e016f6c23636bddcc784d55..ab0e6ec97bd4bae8b2609e0ff343ba89a18a2ef3 100644
--- a/resources/static/test/qunit/js/browserid_unit_test.js
+++ b/resources/static/test/qunit/pages/browserid_unit_test.js
@@ -34,11 +34,11 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
-steal.plugins("jquery", "funcunit/qunit").then("/js/page_helpers", "/js/browserid", function() {
+steal.plugins("jquery", "funcunit/qunit").then("/pages/page_helpers", "/pages/browserid", function() {
   "use strict";
 
-  module("/js/browserid");
-  
+  module("/pages/browserid");
+
 
 });
 
diff --git a/resources/static/test/qunit/pages/forgot_unit_test.js b/resources/static/test/qunit/pages/forgot_unit_test.js
index 2dbbca592ba47822b965e2e7621417b30b9717d7..d49932e667cf4f461fb9d3b754dd1af942dd41c0 100644
--- a/resources/static/test/qunit/pages/forgot_unit_test.js
+++ b/resources/static/test/qunit/pages/forgot_unit_test.js
@@ -34,7 +34,7 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
-steal.plugins("jquery").then("/dialog/resources/network", "/dialog/resources/user", "/js/pages/forgot", function() {
+steal.plugins("jquery").then("/resources/network", "/resources/user", "/pages/forgot", function() {
   "use strict";
 
   var bid = BrowserID,
@@ -110,7 +110,7 @@ steal.plugins("jquery").then("/dialog/resources/network", "/dialog/resources/use
     $("#email").val("testuser@testuser.com");
 
     testEmailNotSent(function() {
-      equal($("#error").is(":visible"), true, "error is visible");  
+      equal($("#error").is(":visible"), true, "error is visible");
       start();
     });
   });
diff --git a/resources/static/test/qunit/pages/manage_account_unit_test.js b/resources/static/test/qunit/pages/manage_account_unit_test.js
index c981153d2974acab134053d479a2282f25845463..97a4b8a9b9e08b2edb2ba5d672c090360c4fcd4c 100644
--- a/resources/static/test/qunit/pages/manage_account_unit_test.js
+++ b/resources/static/test/qunit/pages/manage_account_unit_test.js
@@ -34,7 +34,7 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
-steal.plugins("jquery").then("/dialog/resources/network", "/js/pages/manage_account", function() {
+steal.plugins("jquery").then("/resources/network", "/pages/manage_account", function() {
   "use strict";
 
   var bid = BrowserID,
@@ -53,7 +53,7 @@ steal.plugins("jquery").then("/dialog/resources/network", "/js/pages/manage_acco
 
   module("pages/manage_account", {
     setup: function() {
-      network.setXHR(xhr);  
+      network.setXHR(xhr);
       xhr.useResult("valid");
       user.setOrigin(TEST_ORIGIN);
       $("#emailList").empty();
@@ -62,7 +62,7 @@ steal.plugins("jquery").then("/dialog/resources/network", "/js/pages/manage_acco
       storage.clear();
     },
     teardown: function() {
-      network.setXHR($);  
+      network.setXHR($);
       $("#emailList").empty();
       $("#error").hide();
     }
@@ -74,7 +74,7 @@ steal.plugins("jquery").then("/dialog/resources/network", "/js/pages/manage_acco
     bid.manageAccount(mocks);
 
     setTimeout(function() {
-      equal($("#emailList").children().length, 0, "no children have been added"); 
+      equal($("#emailList").children().length, 0, "no children have been added");
       start();
     }, TEST_DELAY);
 
@@ -85,7 +85,7 @@ steal.plugins("jquery").then("/dialog/resources/network", "/js/pages/manage_acco
     bid.manageAccount(mocks);
 
     setTimeout(function() {
-      equal($("#emailList").children().length, 1, "there has been one child added"); 
+      equal($("#emailList").children().length, 1, "there has been one child added");
       start();
     }, TEST_DELAY);
 
@@ -98,7 +98,7 @@ steal.plugins("jquery").then("/dialog/resources/network", "/js/pages/manage_acco
     bid.manageAccount(mocks);
 
     setTimeout(function() {
-      equal($("#error").is(":visible"), true, "error message is visible on XHR error"); 
+      equal($("#error").is(":visible"), true, "error message is visible on XHR error");
       start();
     }, ERROR_DELAY);
 
@@ -117,7 +117,7 @@ steal.plugins("jquery").then("/dialog/resources/network", "/js/pages/manage_acco
       bid.manageAccount.removeEmail("testuser@testuser.com");
 
       setTimeout(function() {
-        equal($("#emailList").children().length, 1, "after removing an email, only one remains"); 
+        equal($("#emailList").children().length, 1, "after removing an email, only one remains");
         start();
       }, TEST_DELAY);
     }, TEST_DELAY);
@@ -136,7 +136,7 @@ steal.plugins("jquery").then("/dialog/resources/network", "/js/pages/manage_acco
       bid.manageAccount.removeEmail("testuser@testuser.com");
 
       setTimeout(function() {
-        equal($("#error").is(":visible"), true, "error message is visible on XHR error"); 
+        equal($("#error").is(":visible"), true, "error message is visible on XHR error");
         start();
       }, ERROR_DELAY);
     }, TEST_DELAY);
@@ -170,7 +170,7 @@ steal.plugins("jquery").then("/dialog/resources/network", "/js/pages/manage_acco
       bid.manageAccount.removeEmail("testuser@testuser.com");
 
       setTimeout(function() {
-        equal($("#error").is(":visible"), true, "error message is visible on XHR error"); 
+        equal($("#error").is(":visible"), true, "error message is visible on XHR error");
         start();
       }, ERROR_DELAY);
     }, TEST_DELAY);
@@ -202,7 +202,7 @@ steal.plugins("jquery").then("/dialog/resources/network", "/js/pages/manage_acco
       bid.manageAccount.cancelAccount();
 
       setTimeout(function() {
-        equal($("#error").is(":visible"), true, "error message is visible on XHR error"); 
+        equal($("#error").is(":visible"), true, "error message is visible on XHR error");
         start();
       }, ERROR_DELAY);
     }, TEST_DELAY);
diff --git a/resources/static/test/qunit/js/page_helpers_unit_test.js b/resources/static/test/qunit/pages/page_helpers_unit_test.js
similarity index 95%
rename from resources/static/test/qunit/js/page_helpers_unit_test.js
rename to resources/static/test/qunit/pages/page_helpers_unit_test.js
index 9f076596ea5b4691651f1e9fa7705923b556fc02..1ccd4958d0ce16788cb5e67e2072479fa17d6991 100644
--- a/resources/static/test/qunit/js/page_helpers_unit_test.js
+++ b/resources/static/test/qunit/pages/page_helpers_unit_test.js
@@ -34,13 +34,13 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
-steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/browserid", function() {
+steal.plugins("jquery", "funcunit/qunit").then("/resources/browserid", function() {
   "use strict";
 
   var pageHelpers = BrowserID.PageHelpers;
 
-  module("/js/page_helpers");
-  
+  module("pages/page_helpers");
+
 
   test("setStoredEmail/getStoredEmail/setupEmail prefills the email address", function() {
     $("#email").val("");
@@ -58,7 +58,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/browserid", fu
     pageHelpers.setStoredEmail("testuser@testuser.co");
     pageHelpers.setupEmail();
 
-    // The fake jQuery event does not actually cause the letter to be added, we 
+    // The fake jQuery event does not actually cause the letter to be added, we
     // have to do that manually.
     $("#email").val("testuser@testuser.com");
 
diff --git a/resources/static/test/qunit/pages/signin_unit_test.js b/resources/static/test/qunit/pages/signin_unit_test.js
index ad6738d65ec8df41717e0c25135f7371673c713b..28d907a7fefd7e3f18a8e74c685c32e8b8e64ab4 100644
--- a/resources/static/test/qunit/pages/signin_unit_test.js
+++ b/resources/static/test/qunit/pages/signin_unit_test.js
@@ -34,7 +34,7 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
-steal.plugins("jquery").then("/test/qunit/mocks/xhr", "/dialog/resources/network", "/dialog/resources/user", "/js/pages/signin", function() {
+steal.plugins("jquery").then("/test/qunit/mocks/xhr", "/resources/network", "/resources/user", "/pages/signin", function() {
   "use strict";
 
   var bid = BrowserID,
@@ -118,7 +118,7 @@ steal.plugins("jquery").then("/test/qunit/mocks/xhr", "/dialog/resources/network
 
     testUserNotSignedIn(function() {
       setTimeout(function() {
-        equal($("#error").is(":visible"), true, "error is visible");  
+        equal($("#error").is(":visible"), true, "error is visible");
         start();
       }, 500);
     });
diff --git a/resources/static/test/qunit/pages/signup_unit_test.js b/resources/static/test/qunit/pages/signup_unit_test.js
index 3644704e374b6ec0103cbcac5e93dd7c4af44017..57b2d6c07dcfbffe463799cfb3d9d96e597d1bee 100644
--- a/resources/static/test/qunit/pages/signup_unit_test.js
+++ b/resources/static/test/qunit/pages/signup_unit_test.js
@@ -34,7 +34,7 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
-steal.plugins("jquery").then("/test/qunit/mocks/xhr", "/dialog/resources/network", "/dialog/resources/user", "/js/pages/signup", function() {
+steal.plugins("jquery").then("/test/qunit/mocks/xhr", "/resources/network", "/resources/user", "/pages/signup", function() {
   "use strict";
 
   var bid = BrowserID,
diff --git a/resources/static/test/qunit/pages/verify_email_address_test.js b/resources/static/test/qunit/pages/verify_email_address_test.js
index 879e8cf0a3d45d27f580bb74b3e78f3d69d5cee1..1108be14c4126be08abfba5b190ecd4a3204c4b1 100644
--- a/resources/static/test/qunit/pages/verify_email_address_test.js
+++ b/resources/static/test/qunit/pages/verify_email_address_test.js
@@ -34,7 +34,7 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
-steal.plugins("jquery").then("/dialog/resources/network", "/js/pages/verify_email_address", function() {
+steal.plugins("jquery").then("/resources/network", "/pages/verify_email_address", function() {
   "use strict";
 
   var bid = BrowserID,
@@ -42,16 +42,16 @@ steal.plugins("jquery").then("/dialog/resources/network", "/js/pages/verify_emai
       storage = bid.Storage,
       xhr = bid.Mocks.xhr,
       validToken = true;
-  
+
   module("pages/verify_email_address", {
     setup: function() {
-      network.setXHR(xhr);  
+      network.setXHR(xhr);
       xhr.useResult("valid");
       $("#error,.error").stop().hide();
       $(".website").text("");
     },
     teardown: function() {
-      network.setXHR($);  
+      network.setXHR($);
       $("#error,.error").stop().hide();
       $(".website").text("");
     }
@@ -61,7 +61,7 @@ steal.plugins("jquery").then("/dialog/resources/network", "/js/pages/verify_emai
     storage.setStagedOnBehalfOf("browserid.org");
 
     bid.verifyEmailAddress("token");
-    
+
     setTimeout(function() {
       equal($("#email").val(), "testuser@testuser.com", "email set");
       ok($(".siteinfo").is(":visible"), "siteinfo is visible when we say what it is");
@@ -77,7 +77,7 @@ steal.plugins("jquery").then("/dialog/resources/network", "/js/pages/verify_emai
 
     bid.verifyEmailAddress("token");
 
-    
+
     setTimeout(function() {
       equal($("#email").val(), "testuser@testuser.com", "email set");
       equal($(".siteinfo").is(":visible"), false, "siteinfo is not visible without having it");
diff --git a/resources/static/test/qunit/qunit.js b/resources/static/test/qunit/qunit.js
index 68a0fe179559cf033fd635f0a7df5727dd78caa8..fa89529412f9e569bde91a2a64558eb46112a3ae 100644
--- a/resources/static/test/qunit/qunit.js
+++ b/resources/static/test/qunit/qunit.js
@@ -1,22 +1,22 @@
-steal("/dialog/resources/browserid.js",
+steal("/resources/browserid.js",
       "/test/qunit/mocks/mocks.js",
       "/test/qunit/mocks/xhr.js",
-      "/dialog/resources/ejs.js",
-      "/dialog/resources/browser-support.js",
-      "/dialog/resources/error-messages.js",
-      "/dialog/resources/error-display.js",
-      "/dialog/resources/storage.js",
-      "/dialog/resources/tooltip.js",
-      "/dialog/resources/validation.js",
-      "/dialog/resources/underscore-min.js"
+      "/lib/ejs.js",
+      "/resources/browser-support.js",
+      "/resources/error-messages.js",
+      "/resources/error-display.js",
+      "/resources/storage.js",
+      "/resources/tooltip.js",
+      "/resources/validation.js",
+      "/lib/underscore-min.js"
       )
   .plugins("jquery",
     "jquery/controller",
     "jquery/controller/subscribe",
     "funcunit/qunit")
-  .then("/dialog/resources/dom-jquery.js",
-        "js/browserid_unit_test",
-        "js/page_helpers_unit_test",
+  .then("/lib/dom-jquery.js",
+        "pages/browserid_unit_test",
+        "pages/page_helpers_unit_test",
         "include_unit_test",
         "relay/relay_unit_test",
         "pages/add_email_address_test",
diff --git a/resources/static/test/qunit/relay/relay_unit_test.js b/resources/static/test/qunit/relay/relay_unit_test.js
index ae7e6dc6109e84fd1d7e6957d0e208a14218212f..566c5a90fc9dee8a9662ffe2c27d1b97e60338c6 100644
--- a/resources/static/test/qunit/relay/relay_unit_test.js
+++ b/resources/static/test/qunit/relay/relay_unit_test.js
@@ -34,7 +34,7 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
-steal.plugins("jquery").then("/dialog/resources/jschannel", "/relay/relay", function() {
+steal.plugins("jquery").then("/lib/jschannel", "/relay/relay", function() {
   "use strict";
 
   var winMock = {},
@@ -44,7 +44,7 @@ steal.plugins("jquery").then("/dialog/resources/jschannel", "/relay/relay", func
     build: function(options) {
       this.options = options;
 
-      channelMock.bindMessage = channelMock.cb = channelMock.status = 
+      channelMock.bindMessage = channelMock.cb = channelMock.status =
         channelMock.errorCode = channelMock.verboseError = undefined;
 
       return {
@@ -59,7 +59,7 @@ steal.plugins("jquery").then("/dialog/resources/jschannel", "/relay/relay", func
     receiveGetVerifiedEmail: function() {
       // cb is the mock callback that is passed to Channel.bind
       channelMock.cb({
-        origin: "Origin", 
+        origin: "Origin",
         delayReturn: function() {},
         complete: function(status) {
           channelMock.status = status;
@@ -84,13 +84,13 @@ steal.plugins("jquery").then("/dialog/resources/jschannel", "/relay/relay", func
     teardown: function() {
       relay.init({
         window: window.parent,
-        channel: Channel 
+        channel: Channel
       });
     }
   });
 
   test("Can open the relay, happy case", function() {
-    relay.open(); 
+    relay.open();
 
     /**
      * Check to make sure channel build is correct
diff --git a/resources/static/test/qunit/resources/browser-support_unit_test.js b/resources/static/test/qunit/resources/browser-support_unit_test.js
index a26857f01eef422ad03c0cc49fbb4d9257957cef..36a29531c52ffa4d59011358765979f623431bff 100644
--- a/resources/static/test/qunit/resources/browser-support_unit_test.js
+++ b/resources/static/test/qunit/resources/browser-support_unit_test.js
@@ -42,7 +42,7 @@ steal.plugins("jquery", "funcunit/qunit").then(function() {
       stubWindow,
       stubNavigator;
 
-  module("browser-support", {
+  module("resources/browser-support", {
     setup: function() {
       // Hard coded goodness for testing purposes
       stubNavigator = {
@@ -61,7 +61,7 @@ steal.plugins("jquery", "funcunit/qunit").then(function() {
     teardown: function() {
     }
   });
-  
+
   test("browser without localStorage", function() {
     delete stubWindow.localStorage;
 
diff --git a/resources/static/test/qunit/resources/error-display_unit_test.js b/resources/static/test/qunit/resources/error-display_unit_test.js
index 842ba40d82ad0adfa4b01f08baf578427c84dac7..162aeee56da67c668d19b331f25022f0f09e04fe 100644
--- a/resources/static/test/qunit/resources/error-display_unit_test.js
+++ b/resources/static/test/qunit/resources/error-display_unit_test.js
@@ -1,4 +1,4 @@
-/*jshint browser:true, jQuery: true, forin: true, laxbreak:true */                                             
+/*jshint browser:true, jQuery: true, forin: true, laxbreak:true */
 /*globals BrowserID: true, _:true */
 /* ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
@@ -34,7 +34,7 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
-steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/error-display", function() {
+steal.plugins("jquery", "funcunit/qunit").then("/resources/error-display", function() {
   "use strict";
 
   var bid = BrowserID,
diff --git a/resources/static/test/qunit/resources/network_unit_test.js b/resources/static/test/qunit/resources/network_unit_test.js
index cfd90f41d51b242263c573db20395d800c739f98..97dce2b7d01e61c6c7a100d91601e5aa6548f967 100644
--- a/resources/static/test/qunit/resources/network_unit_test.js
+++ b/resources/static/test/qunit/resources/network_unit_test.js
@@ -34,7 +34,7 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
-steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/network", function() {
+steal.plugins("jquery", "funcunit/qunit").then("/resources/network", function() {
   "use strict";
 
   var testName,
@@ -53,8 +53,8 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/network", func
   }
 
   function notificationCheck(cb) {
-    // Take the original arguments, take off the function.  Add any additional 
-    // arguments that were passed in, and then tack on the onSuccess and 
+    // Take the original arguments, take off the function.  Add any additional
+    // arguments that were passed in, and then tack on the onSuccess and
     // onFailure to the end.  Then call the callback.
     var args = Array.prototype.slice.call(arguments, 1);
 
@@ -82,11 +82,11 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/network", func
   }
 
   function failureCheck(cb) {
-    // Take the original arguments, take off the function.  Add any additional 
-    // arguments that were passed in, and then tack on the onSuccess and 
+    // Take the original arguments, take off the function.  Add any additional
+    // arguments that were passed in, and then tack on the onSuccess and
     // onFailure to the end.  Then call the callback.
     var args = Array.prototype.slice.call(arguments, 1);
-    
+
     args.push(function onSuccess(authenticated) {
       ok(false, "XHR failure should never pass");
       wrappedStart();
@@ -187,8 +187,8 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/network", func
     xhr.useResult("ajaxError");
     xhr.setContextInfo("authenticated", false);
 
-    // Do not convert this to failureCheck, we do this manually because 
-    // checkAuth does not make an XHR request.  Since it does not make an XHR 
+    // Do not convert this to failureCheck, we do this manually because
+    // checkAuth does not make an XHR request.  Since it does not make an XHR
     // request, we do not test whether the app is notified of an XHR failure
     network.checkAuth(function onSuccess() {
       ok(true, "checkAuth does not make an ajax call, all good");
@@ -227,7 +227,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/network", func
   wrappedAsyncTest("complete_email_addition valid", function() {
     network.completeEmailRegistration("goodtoken", function onSuccess(proven) {
       equal(proven, true, "good token proved");
-      wrappedStart(); 
+      wrappedStart();
     }, function onFailure() {
       wrappedStart();
     });
@@ -239,7 +239,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/network", func
     xhr.useResult("invalid");
     network.completeEmailRegistration("badtoken", function onSuccess(proven) {
       equal(proven, false, "bad token could not be proved");
-      wrappedStart(); 
+      wrappedStart();
     }, function onFailure() {
       wrappedStart();
     });
@@ -647,8 +647,8 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/network", func
     network.serverTime(function onSuccess(time) {
       var diff = Math.abs((new Date()) - time);
       equal(1245 < diff && diff < 1255, true, "server time and local time should be less than 100ms different (is " + diff + "ms different)");
-      // XXX by stomlinson - I think this is an incorrect test.  The time returned here is the 
-      // time as it is on the server, which could be more than 100ms off of 
+      // XXX by stomlinson - I think this is an incorrect test.  The time returned here is the
+      // time as it is on the server, which could be more than 100ms off of
       // what the local machine says it is.
       //equal(Math.abs(diff) < 100, true, "server time and local time should be less than 100ms different (is " + diff + "ms different)");
       wrappedStart();
diff --git a/resources/static/test/qunit/resources/storage_unit_test.js b/resources/static/test/qunit/resources/storage_unit_test.js
index 40e17f5a7e872b4d05368b2b6e49cfc72f170a6b..1f7e2ec7981cb18806d0d101ba211d09301688b6 100644
--- a/resources/static/test/qunit/resources/storage_unit_test.js
+++ b/resources/static/test/qunit/resources/storage_unit_test.js
@@ -34,7 +34,7 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
-steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/storage", function() {
+steal.plugins("jquery", "funcunit/qunit").then("/resources/storage", function() {
   var storage = BrowserID.Storage;
 
   module("storage", {
@@ -141,9 +141,9 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/storage", func
     try {
       storage.site.set("www.testsite.com", "email", "testuser@testuser.com");
     } catch(e) {
-      error = e; 
+      error = e;
     }
-    
+
     equal(error.toString(), "unknown email address", "An unknown email address was added");
   });
 
diff --git a/resources/static/test/qunit/resources/tooltip_unit_test.js b/resources/static/test/qunit/resources/tooltip_unit_test.js
index ab12693190b8de498bdc9a7f9e3ef2aae0d5c77b..3070b00803347f4785bf05711d750f9b8c952b98 100644
--- a/resources/static/test/qunit/resources/tooltip_unit_test.js
+++ b/resources/static/test/qunit/resources/tooltip_unit_test.js
@@ -1,4 +1,4 @@
-/*jshint browser:true, jQuery: true, forin: true, laxbreak:true */                                             
+/*jshint browser:true, jQuery: true, forin: true, laxbreak:true */
 /*globals BrowserID: true, _:true */
 /* ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
@@ -34,7 +34,7 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
-steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/tooltip", function() {
+steal.plugins("jquery", "funcunit/qunit").then("/resources/tooltip", function() {
   "use strict";
 
   var bid = BrowserID,
diff --git a/resources/static/test/qunit/resources/user_unit_test.js b/resources/static/test/qunit/resources/user_unit_test.js
index 5efbb5dbb52adfba5fe0391c0cbbd99fb5fb316e..a70a87633626fdb521e97b96586205bd41cac554 100644
--- a/resources/static/test/qunit/resources/user_unit_test.js
+++ b/resources/static/test/qunit/resources/user_unit_test.js
@@ -38,7 +38,7 @@ var jwk = require("./jwk");
 var jwt = require("./jwt");
 var jwcert = require("./jwcert");
 
-steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", function() {
+steal.plugins("jquery", "funcunit/qunit").then("/resources/user", function() {
   var lib = BrowserID.User,
       storage = BrowserID.Storage,
       xhr = BrowserID.Mocks.xhr,
@@ -56,7 +56,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
 
     // Decode the assertion to a bundle.
     var bundle = JSON.parse(window.atob(assertion));
-    
+
     // Make sure both parts of the bundle exist
     ok(bundle.certificates && bundle.certificates.length, "we have an array like object for the certificates");
     equal(typeof bundle.assertion, "string");
@@ -70,9 +70,9 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
     equal(tok.audience, testOrigin, "correct audience");
     var expires = tok.expires.getTime();
     ok(typeof expires === "number" && !isNaN(expires), "expiration date is valid");
-  
+
     var nowPlus2Mins = new Date().getTime() + (2 * 60 * 1000);
-    // expiration date must be within 5 seconds of 2 minutes from now - see 
+    // expiration date must be within 5 seconds of 2 minutes from now - see
     // issue 433 (https://github.com/mozilla/browserid/issues/433)
     ok(((nowPlus2Mins - 5000) < expires) && (expires < (nowPlus2Mins + 5000)), "expiration date must be within 5 seconds of 2 minutes from now");
 
@@ -115,7 +115,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
     lib.setOrigin(origin);
 
     var hostname = lib.getHostname();
-    equal(hostname, "testorigin.com", "getHostname returns only the hostname"); 
+    equal(hostname, "testorigin.com", "getHostname returns only the hostname");
   });
 
   test("getStoredEmailKeypairs", function() {
@@ -144,9 +144,9 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
     lib.clearStoredEmailKeypairs();
     var identities = lib.getStoredEmailKeypairs();
     var count = 0;
-    for(var key in identities) { 
+    for(var key in identities) {
       if(identities.hasOwnProperty(key)) {
-        count++; 
+        count++;
       }
     }
 
@@ -180,7 +180,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
       ok(false, "xhr failure should never succeed");
       start();
     }, function() {
-      ok(true, "xhr failure should always be a failure"); 
+      ok(true, "xhr failure should always be a failure");
       start();
     });
 
@@ -243,7 +243,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
       start();
     }, function() {
       ok(storage.getStagedOnBehalfOf(), "staged on behalf of is not cleared on XHR failure");
-      ok(true, "xhr failure should always be a failure"); 
+      ok(true, "xhr failure should always be a failure");
       start();
     });
 
@@ -254,7 +254,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
     storage.setStagedOnBehalfOf(testOrigin);
 
     lib.verifyUser("token", "password", function onSuccess(info) {
-      
+
       ok(info.valid, "token was valid");
       equal(info.email, "testuser@testuser.com", "email part of info");
       equal(info.origin, testOrigin, "origin in info");
@@ -270,7 +270,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
     xhr.useResult("invalid");
 
     lib.verifyUser("token", "password", function onSuccess(info) {
-      
+
       equal(info.valid, false, "bad token calls onSuccess with a false validity");
 
       start();
@@ -287,10 +287,10 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
       ok(false, "xhr failure should never succeed");
       start();
     }, function() {
-      ok(true, "xhr failure should always be a failure"); 
+      ok(true, "xhr failure should always be a failure");
       start();
     });
-      
+
     stop();
   });
 
@@ -310,7 +310,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
       equal(status.success, true, "password reset for known user");
       start();
     }, function() {
-      ok(false, "onFailure should not be called"); 
+      ok(false, "onFailure should not be called");
       start();
     });
 
@@ -323,7 +323,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
       equal(status.reason, "invalid_user", "invalid_user is the reason");
       start();
     }, function() {
-      ok(false, "onFailure should not be called"); 
+      ok(false, "onFailure should not be called");
       start();
     });
 
@@ -337,7 +337,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
       equal(status.reason, "throttle", "password reset was throttled");
       start();
     }, function() {
-      ok(false, "onFailure should not be called"); 
+      ok(false, "onFailure should not be called");
       start();
     });
 
@@ -350,7 +350,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
       ok(false, "xhr failure should never succeed");
       start();
     }, function() {
-      ok(true, "xhr failure should always be a failure"); 
+      ok(true, "xhr failure should always be a failure");
       start();
     });
 
@@ -387,7 +387,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
       ok(false, "xhr failure should never succeed");
       start();
     }, function() {
-      ok(true, "xhr failure should always be a failure"); 
+      ok(true, "xhr failure should always be a failure");
       start();
     });
 
@@ -426,7 +426,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
       ok(false, "xhr failure should never succeed");
       start();
     }, function() {
-      ok(true, "xhr failure should always be a failure"); 
+      ok(true, "xhr failure should always be a failure");
       start();
     });
 
@@ -471,10 +471,10 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
     lib.checkAuthenticationAndSync(function onSuccess() {
     }, function onComplete() {
       ok(false, "xhr failure should never succeed");
-      
+
       start();
     }, function onFailure() {
-      ok(true, "xhr failure should always be a failure"); 
+      ok(true, "xhr failure should always be a failure");
       start();
     });
 
@@ -512,7 +512,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
       ok(false, "xhr failure should never succeed");
       start();
     }, function() {
-      ok(true, "xhr failure should always be a failure"); 
+      ok(true, "xhr failure should always be a failure");
       start();
     });
 
@@ -526,7 +526,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
       var identities = lib.getStoredEmailKeypairs();
       equal(false, "testemail@testemail.com" in identities, "Our new email is not added until confirmation.");
 
-      equal(storage.getStagedOnBehalfOf(), lib.getHostname(), "initiatingOrigin is stored"); 
+      equal(storage.getStagedOnBehalfOf(), lib.getHostname(), "initiatingOrigin is stored");
 
       start();
     }, failure("addEmail failure"));
@@ -543,7 +543,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
       var identities = lib.getStoredEmailKeypairs();
       equal(false, "testemail@testemail.com" in identities, "Our new email is not added until confirmation.");
 
-      equal(typeof storage.getStagedOnBehalfOf(), "undefined", "initiatingOrigin is not stored"); 
+      equal(typeof storage.getStagedOnBehalfOf(), "undefined", "initiatingOrigin is not stored");
 
       start();
     }, failure("addEmail failure"));
@@ -557,7 +557,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
       ok(false, "xhr failure should never succeed");
       start();
     }, function() {
-      ok(true, "xhr failure should always be a failure"); 
+      ok(true, "xhr failure should always be a failure");
       start();
     });
 
@@ -617,7 +617,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
       start();
     }, function() {
       ok(storage.getStagedOnBehalfOf(), "staged on behalf of is cleared when validation completes");
-      ok(true, "xhr failure should always be a failure"); 
+      ok(true, "xhr failure should always be a failure");
       start();
     });
 
@@ -628,7 +628,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
   test("verifyEmail with a good token", function() {
     storage.setStagedOnBehalfOf(testOrigin);
     lib.verifyEmail("token", function onSuccess(info) {
-      
+
       ok(info.valid, "token was valid");
       equal(info.email, "testuser@testuser.com", "email part of info");
       equal(info.origin, testOrigin, "origin in info");
@@ -644,7 +644,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
     xhr.useResult("invalid");
 
     lib.verifyEmail("token", function onSuccess(info) {
-      
+
       equal(info.valid, false, "bad token calls onSuccess with a false validity");
 
       start();
@@ -661,10 +661,10 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
       ok(false, "xhr failure should never succeed");
       start();
     }, function() {
-      ok(true, "xhr failure should always be a failure"); 
+      ok(true, "xhr failure should always be a failure");
       start();
     });
-      
+
     stop();
   });
 
@@ -692,7 +692,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
       var identity = lib.getStoredEmailKeypair("testemail@testemail.com");
       equal(typeof identity, "undefined", "Invalid email is not synced");
 
-      start();      
+      start();
     });
 
     stop();
@@ -704,7 +704,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
       ok(false, "xhr failure should never succeed");
       start();
     }, function() {
-      ok(true, "xhr failure should always be a failure"); 
+      ok(true, "xhr failure should always be a failure");
       start();
     });
 
@@ -744,7 +744,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
       ok(false, "xhr failure should never succeed");
       start();
     }, function() {
-      ok(true, "xhr failure should always be a failure"); 
+      ok(true, "xhr failure should always be a failure");
       start();
     });
 
@@ -771,7 +771,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
       var identities = lib.getStoredEmailKeypairs();
       ok("testuser@testuser.com" in identities, "Our new email is added");
       equal(_.size(identities), 1, "there is one identity");
-      start(); 
+      start();
     }, failure("identity sync failure"));
 
     stop();
@@ -841,7 +841,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
       ok(false, "xhr failure should never succeed");
       start();
     }, function() {
-      ok(true, "xhr failure should always be a failure"); 
+      ok(true, "xhr failure should always be a failure");
       start();
     });
 
@@ -880,7 +880,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
         start();
       });
     }, failure("getAssertion failure"));
-    
+
     stop();
   });
 
@@ -892,7 +892,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
       ok(false, "xhr failure should never succeed");
       start();
     }, function() {
-      ok(true, "xhr failure should always be a failure"); 
+      ok(true, "xhr failure should always be a failure");
       start();
     });
 
@@ -927,7 +927,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
           ok(false, "xhr failure should never succeed");
           start();
         }, function() {
-          ok(true, "xhr failure should always be a failure"); 
+          ok(true, "xhr failure should always be a failure");
           start();
         });
 
@@ -954,7 +954,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
       ok(false, "xhr failure should never succeed");
       start();
     }, function() {
-      ok(true, "xhr failure should always be a failure"); 
+      ok(true, "xhr failure should always be a failure");
       start();
     });
 
@@ -1002,7 +1002,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
     lib.syncEmailKeypair("testuser@testuser.com", function() {
       storage.site.set(testOrigin, "remember", false);
       storage.site.set(testOrigin, "email", "testuser@testuser.com");
-      // invalidate the email so that we force a fresh key certification with 
+      // invalidate the email so that we force a fresh key certification with
       // the server
       storage.invalidateEmail("testuser@testuser.com");
 
@@ -1023,7 +1023,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
     lib.syncEmailKeypair("testuser@testuser.com", function() {
       storage.site.set(testOrigin, "remember", true);
       storage.site.set(testOrigin, "email", "testuser@testuser.com");
-      // invalidate the email so that we force a fresh key certification with 
+      // invalidate the email so that we force a fresh key certification with
       // the server
       storage.invalidateEmail("testuser@testuser.com");
 
@@ -1044,7 +1044,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/user", functio
     lib.syncEmailKeypair("testuser@testuser.com", function() {
       storage.site.set(testOrigin, "remember", true);
       storage.site.set(testOrigin, "email", "testuser@testuser.com");
-      // invalidate the email so that we force a fresh key certification with 
+      // invalidate the email so that we force a fresh key certification with
       // the server
       storage.invalidateEmail("testuser@testuser.com");
 
diff --git a/resources/static/test/qunit/resources/validation_unit_test.js b/resources/static/test/qunit/resources/validation_unit_test.js
index 7b7c532a331a55f06f09522d5a9d07dbc098a463..d834ba9ba731d661e203ea3a6ab60d911dd8dbd0 100644
--- a/resources/static/test/qunit/resources/validation_unit_test.js
+++ b/resources/static/test/qunit/resources/validation_unit_test.js
@@ -34,7 +34,7 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
-steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/browserid", function() {
+steal.plugins("jquery", "funcunit/qunit").then("/resources/browserid", function() {
   "use strict";
 
   var bid = BrowserID,
@@ -57,7 +57,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/browserid", fu
       bid.Tooltip.showTooltip = origShowTooltip;
     }
   });
-  
+
   test("email address x@y.z is valid", function() {
     ok(bid.verifyEmail("x@y.z"), "x@y.z is valid");
   });
@@ -87,7 +87,7 @@ steal.plugins("jquery", "funcunit/qunit").then("/dialog/resources/browserid", fu
   });
 
 
-  
+
   test("email with valid email", function() {
     var valid = validation.email("testuser@testuser.com");
 
diff --git a/resources/views/dialog_layout.ejs b/resources/views/dialog_layout.ejs
index a2b6ce692a36d56f5d004f41ce92ce8c40f4b6c2..ddc32e74fd0f5f2e5b704fbc0af7f79fb64d99e3 100644
--- a/resources/views/dialog_layout.ejs
+++ b/resources/views/dialog_layout.ejs
@@ -2,7 +2,7 @@
 <html>
 <head>
   <meta charset="utf-8">
-  <meta name="viewport" content="initial-scale=1.0; maximum-scale=1.0; width=device-width;">  
+  <meta name="viewport" content="initial-scale=1.0; maximum-scale=1.0; width=device-width;">
   <!--[if lt IE 9]>
     <script type="text/javascript" src="/js/html5shim.js"></script>
   <![endif]-->
diff --git a/resources/views/layout.ejs b/resources/views/layout.ejs
index 02906973378a8d10cf49d9790d68ecf5270f0699..2f8a3d00969ac316e0519fd9d8605d97f7b79aa1 100644
--- a/resources/views/layout.ejs
+++ b/resources/views/layout.ejs
@@ -10,32 +10,32 @@
   <script src="/vepbundle" type="text/javascript"></script>
   <% if (production) { %>
     <link rel="stylesheet" type="text/css" href="/css/browserid.min.css">
-    <script src="/js/lib.min.js" type="text/javascript"></script>
+    <script src="/pages/lib.min.js" type="text/javascript"></script>
   <% } else { %>
     <link rel="stylesheet" href="/css/style.css" type="text/css" media="screen">
     <link rel="stylesheet" href="/css/m.css" type="text/css" media="screen">
 
-    <script src="/js/jquery-1.6.2.min.js" type="text/javascript"></script>
-    <script src="/js/json2.js" type="text/javascript"></script>
-    <script src="/dialog/resources/underscore-min.js" type="text/javascript"></script>
-    <script src="/dialog/resources/browserid-extensions.js" type="text/javascript"></script>
-    <script src="/dialog/resources/browserid.js" type="text/javascript"></script>
-    <script src="/dialog/resources/error-display.js" type="text/javascript"></script>
-    <script src="/dialog/resources/error-messages.js" type="text/javascript"></script>
-    <script src="/js/page_helpers.js" type="text/javascript"></script>
-    <script src="/js/browserid.js" type="text/javascript"></script>
-    <script src="/js/pages/index.js" type="text/javascript"></script>
-    <script src="/dialog/resources/storage.js" type="text/javascript"></script>
-    <script src="/dialog/resources/network.js" type="text/javascript"></script>
-    <script src="/dialog/resources/user.js" type="text/javascript"></script>
-    <script src="/dialog/resources/tooltip.js" type="text/javascript"></script>
-    <script src="/dialog/resources/validation.js" type="text/javascript"></script>
-    <script src="/js/pages/add_email_address.js" type="text/javascript"></script>
-    <script src="/js/pages/verify_email_address.js" type="text/javascript"></script>
-    <script src="/js/pages/forgot.js" type="text/javascript"></script>
-    <script src="/js/pages/manage_account.js" type="text/javascript"></script>
-    <script src="/js/pages/signin.js" type="text/javascript"></script>
-    <script src="/js/pages/signup.js" type="text/javascript"></script>
+    <script src="/lib/jquery-1.6.2.min.js" type="text/javascript"></script>
+    <script src="/lib/json2.js" type="text/javascript"></script>
+    <script src="/lib/underscore-min.js" type="text/javascript"></script>
+    <script src="/resources/browserid-extensions.js" type="text/javascript"></script>
+    <script src="/resources/browserid.js" type="text/javascript"></script>
+    <script src="/resources/error-display.js" type="text/javascript"></script>
+    <script src="/resources/error-messages.js" type="text/javascript"></script>
+    <script src="/pages/page_helpers.js" type="text/javascript"></script>
+    <script src="/pages/browserid.js" type="text/javascript"></script>
+    <script src="/pages/index.js" type="text/javascript"></script>
+    <script src="/resources/storage.js" type="text/javascript"></script>
+    <script src="/resources/network.js" type="text/javascript"></script>
+    <script src="/resources/user.js" type="text/javascript"></script>
+    <script src="/resources/tooltip.js" type="text/javascript"></script>
+    <script src="/resources/validation.js" type="text/javascript"></script>
+    <script src="/pages/add_email_address.js" type="text/javascript"></script>
+    <script src="/pages/verify_email_address.js" type="text/javascript"></script>
+    <script src="/pages/forgot.js" type="text/javascript"></script>
+    <script src="/pages/manage_account.js" type="text/javascript"></script>
+    <script src="/pages/signin.js" type="text/javascript"></script>
+    <script src="/pages/signup.js" type="text/javascript"></script>
   <% } %>
   <title>BrowserID: <%- title %></title>
 </head>
@@ -100,7 +100,7 @@
         {% if (action.message) { %}
           <p>
             {{ action.message }}
-          </p>  
+          </p>
         {% } %}
       </li>
     {% } %}
@@ -111,13 +111,13 @@
         <strong id="network">Network Info:</strong> {{ network.type }}: {{ network.url }}
 
         <p>
-          <strong>Response Code - </strong> {{ network.textStatus }} 
+          <strong>Response Code - </strong> {{ network.textStatus }}
         </p>
 
         {% if (network.errorThrown) { %}
           <p>
             <strong>Error Type:</strong> {{ network.errorThrown }}
-          </p>  
+          </p>
         {% } %}
 
       </li>
diff --git a/resources/views/relay.ejs b/resources/views/relay.ejs
index 1fc38b014dd59ab903ef989de9604ece89eb63c2..53ce9739d8661efe30915d8037b25321c185aab9 100644
--- a/resources/views/relay.ejs
+++ b/resources/views/relay.ejs
@@ -1,21 +1,21 @@
 <!doctype html>
 <html>
 <head>
-  <meta charset="utf-8"> 
+  <meta charset="utf-8">
   <title>Browser ID</title>
 </head>
   <body>
       Relay iframe.  Woohoo!
       <% if (production) { %>
-        <script type='text/javascript' 
+        <script type='text/javascript'
           src='https://browserid.org/relay/production.js'></script>
 
       <% } else { %>
-        <script type='text/javascript' 
-          src='https://browserid.org/dialog/resources/jschannel.js'></script>
-        <script type='text/javascript' 
-          src='https://browserid.org/dialog/resources/browserid.js'></script>
-        <script type='text/javascript' 
+        <script type='text/javascript'
+          src='https://browserid.org/lib/jschannel.js'></script>
+        <script type='text/javascript'
+          src='https://browserid.org/resources/browserid.js'></script>
+        <script type='text/javascript'
           src='https://browserid.org/relay/relay.js'></script>
       <% } %>
 
diff --git a/scripts/compress.sh b/scripts/compress.sh
index 46bff6cdc77fb196ed73a3fea0bb772f1e319608..69e8b934aad2ee37107f90308633f04b888dac32 100755
--- a/scripts/compress.sh
+++ b/scripts/compress.sh
@@ -43,7 +43,7 @@ cat popup.css m.css > production.css
 $JAVA -jar $YUI_LOCATION production.css -o production.min.css
 
 cd ../../relay
-cat ../dialog/resources/jschannel.js ../dialog/resources/browserid.js relay.js > production.js
+cat ../lib/jschannel.js ../resources/browserid.js relay.js > production.js
 $UGLIFY < production.js > production.min.js
 mv production.min.js production.js
 
@@ -52,9 +52,9 @@ echo ''
 echo '****Building BrowserID.org HTML, CSS, and JS****'
 echo ''
 
-cd ../js
+cd ../pages
 # re-minimize everything together
-cat jquery-1.6.2.min.js json2.js ../dialog/resources/browserid.js ../dialog/resources/error-display.js ../dialog/resources/error-messages.js page_helpers.js browserid.js ../dialog/resources/underscore-min.js ../dialog/resources/browserid-extensions.js ../dialog/resources/storage.js ../dialog/resources/network.js ../dialog/resources/user.js ../dialog/resources/tooltip.js ../dialog/resources/validation.js pages/index.js pages/add_email_address.js pages/verify_email_address.js pages/manage_account.js pages/signin.js pages/signup.js pages/forgot.js > lib.js
+cat ../lib/jquery-1.6.2.min.js ../lib/json2.js ../resources/browserid.js ../resources/error-display.js ../resources/error-messages.js page_helpers.js browserid.js ../lib/underscore-min.js ../resources/browserid-extensions.js ../resources/storage.js ../resources/network.js ../resources/user.js ../resources/tooltip.js ../resources/validation.js index.js add_email_address.js verify_email_address.js manage_account.js signin.js signup.js forgot.js > lib.js
 $UGLIFY < lib.js > lib.min.js
 
 cd ../css