 
               when "destroy"
                 dbrequests[item[1]] = store.delete(item[1])
-                file = item[1] + ".seed"
+                file = item[1]
 
                 # Delete in the butt
                 $.ajax(
-                  type: "post"
-                  crossDomain: true
-                  dataType: "json"
-                  url: "https://api.dropbox.com/1/fileops/delete"
-                  data: {
-                    root: "sandbox"
-                    path: file
-                  }
-                  beforeSend: (xhr) ->
-                    xhr.setRequestHeader "Authorization", "Bearer " + Sync.oauth.access_token
+                  Sync.generateRequest
+                    request: "destroy"
+                    filename: file
+                    dataType: "text"
                 ).done (data) ->
                   deferred.resolve()
 

          console.log 'All files uploaded, uploading the meta file'

          $.ajax(
            type: "put"
            crossDomain: true
            contentType: "application/octet-stream"
            dataType: "json"
            url: "https://api-content.dropbox.com/1/files_put/sandbox/meta.seed"
            data: Sync.exportData()
            beforeSend: (xhr) ->
              xhr.setRequestHeader 'Authorization', 'Bearer ' + Sync.oauth.access_token
          ).done (data) ->
            console.log("all done! Delete the queue")
            Sync.queue = {"Note": {}, "Notebook": {}}
            Sync.saveQueue()


  connect: (fn) ->



    # Downloads a meta file.
    $.ajax(
      Sync.generateRequest
        request: "download"
        filename: "meta"
    ).done((data) ->
      console.log(JSON.parse(Sync.exportData()), data, Sync.queue)
      result = Sync.merger(JSON.parse(Sync.exportData()), data, Sync.queue)
