             db.deleteItem(request, cb)
           (error, result)->
             if error?
-              callback(error, null)
+              cb(error, null)
             else
-              callback(null, true)
+              cb(null, true)
           )
       ]
 
-      delete_s3_snapshots: ['list_snapshots', (callback, results) ->
-        return callback(null, {}) if results.list_snapshots.Count == 0
+      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?
-              callback(error, null)
+              cb(error, null)
             else
-              callback(null, true)
+              cb(null, true)
           )
       ]
 
-      delete_operations: ['list_operations', (callback, results) ->
-        return callback(null, {}) if results.list_operations.Count == 0
+      delete_operations: ['list_operations', (cb, results) ->
+        return cb(null, {}) if results.list_operations.Count == 0
 
         async.forEachSeries(results.list_operations.Items,
           (item, cb) ->
-            request = 
+            request =
               TableName: operations_table
               Key:
                 HashKeyElement: { S : item.doc.S }

            doc:
              Exists: false

        db.putItem(request, callback)

      write_data: (callback) ->
        path = options.amazon_s3_snapshots_bucket_name+'/'+docName+'-'+docData.v+'.snapshot'
        headers = {}
        data = JSON.stringify(docData.snapshot)

        s3.put(path, headers, data, callback)
    (error, result) ->
      if error? and error.message.match 'The conditional request failed'
        callback?('Document already exists')
      else if error?

            doc:
              Exists: false

        db.putItem(request, cb)

      write_data: (cb) ->
        path = options.amazon_s3_snapshots_bucket_name+'/'+docName+'-'+docData.v+'.snapshot'
        headers = {}
        data = JSON.stringify(docData.snapshot)

        s3.put(path, headers, data, cb)
    (error, results) ->
      if error? and error.message.match 'The conditional request failed'
        callback?('Document already exists')
      else if error?
