diff --git a/browserid/lib/db_json.js b/browserid/lib/db_json.js
index 954007c384a1a1f5d1b391ec9361a98fd8a239da..5e37c1bf0cbe512f73864ab2fa221024f52d005c 100644
--- a/browserid/lib/db_json.js
+++ b/browserid/lib/db_json.js
@@ -67,6 +67,8 @@ exports.addKeyToEmail = function(existing_email, email, pubkey, cb) {
       return;
     }
 
+    if (db[userID].emails
+
     db.execute("SELECT emails.id FROM emails,users WHERE users.id = ? AND emails.address = ? AND emails.user = users.id",
                [ userID, email ],
                function(err, rows) {
@@ -124,16 +126,19 @@ exports.gotVerificationSecret = function(secret, cb) {
   if (o.type === 'add_account') {
     exports.emailKnown(o.email, function(known) {
       function createAccount() {
-        executeTransaction([
-          [ "INSERT INTO users (password) VALUES(?)", [ o.pass ] ] ,
-          [ "INSERT INTO emails (user, address) VALUES(last_insert_rowid(),?)", [ o.email ] ],
-          [ "INSERT INTO keys (email, key, expires) VALUES(last_insert_rowid(),?,?)",
-            [ o.pubkey, ((new Date()).getTime() + (14 * 24 * 60 * 60 * 1000)) ]
+        db.push({
+          password: o.pass,
+          emails: [
+            {
+              address: o.email,
+              keys: [ {
+                key: o.pubkey,
+                expires: ((new Date()).getTime() + (14 * 24 * 60 * 60 * 1000)) 
+              } ]
+            }
           ]
-        ], function (error) {
-          if (error) cb(error);
-          else cb();
         });
+        cb();
       }
 
       // if this email address is known and a user has completed a re-verification of this email
@@ -142,6 +147,7 @@ exports.gotVerificationSecret = function(secret, cb) {
       // NOTE: this might be sub-optimal, but it's a dead simple approach that mitigates many attacks
       // and gives us reasonable behavior (without explicitly supporting) in the face of shared email
       // addresses.
+
       if (known) {
         exports.removeEmail(o.email, o.email, function (err) {
           if (err) cb(err);
@@ -178,6 +184,22 @@ exports.checkAuth = function(email, cb) {
              });
 };
 
+function emailToUserID(email, cb) {
+  var id = undefined;
+  
+  for (var i = 0; i < db.length; i++) {
+    for (var j = 0; j < db[i].emails.length; j++) {
+      if (db[i].emails[j].address === email) {
+        id = i;
+        break;
+      }
+    }
+    if (id !== undefined) break;
+  }
+
+  setTimeout(function() { cb(id); }, 0);
+}
+
 exports.getSyncResponse = function(email, identities, cb) {
   var respBody = {
     unknown_emails: [ ],
diff --git a/browserid/tests/db-test.js b/browserid/tests/db-test.js
index 1f5262d6985d67d94e1aa73efa20191727ec7644..83e51fa5cfadc69553e1b0f17b819f97fa6fcad9 100755
--- a/browserid/tests/db-test.js
+++ b/browserid/tests/db-test.js
@@ -25,7 +25,7 @@ suite.addBatch({
   },
   "opening the database": {
     topic: function() {
-      db.open({ /* driver: 'json', */ path: dbPath }, this.callback);
+      db.open({ driver: 'json', path: dbPath }, this.callback);
     },
     "and its ready": function(r) {
       assert.isUndefined(r);