 
         # TODO: This will only return the latest 1 MB of results, so if there
         # are more keys additional requests must be made.
-        db.query(request, callback)
-
-      delete_snapshots: ['list_snapshots', (callback, results) ->
-        return callback("Document does not exist", null) if results.list_snapshots.Count == 0
+        db.query(request, cb)
+
+      delete_snapshots: ['list_snapshots', (cb, results) ->
+        return cb("Document does not exist", null) if results.list_snapshots.Count == 0
 
         async.mapSeries(results.list_snapshots.Items,
           (item, cb) ->
-            request = 
+            request =
               TableName: snapshots_table
               Key:
                 HashKeyElement: { S : item.doc.S }

  # deleted and the error message if something went wrong.
  @delete = (docName, dbMeta, callback) ->
    async.auto(
      list_snapshots: (callback) ->
        request =
          TableName: snapshots_table
          HashKeyValue: { S: docName }

            db.deleteItem(request, cb)
          (error, result)->
            if error?
              cb(error, null)
            else
              cb(null, true)
          )
      ]

      delete_s3_snapshots: ['list_snapshots', (cb, results) ->
        return cb(null, {}) if results.list_snapshots.Count == 0

        async.forEachSeries(results.list_snapshots.Items,
          (item, cb) ->
            s3.del('/'+snapshots_bucket+'/'+item.doc.S+'-'+item.v.N+'.snapshot', cb)
          (error)->
            if error?
              cb(error, null)
            else
              cb(null, true)
          )
      ]

      delete_operations: ['list_operations', (cb, results) ->
        return cb(null, {}) if results.list_operations.Count == 0

        async.forEachSeries(results.list_operations.Items,
          (item, cb) ->
            request =
              TableName: operations_table
              Key:
                HashKeyElement: { S : item.doc.S }
