 
     request.onsuccess = (e) =>
       result = e.target.result
-      callback(result)
-
-  deleteNote: ->
+      callback(result) if callback
+
+  deleteNote: (callback) ->
     trans = Sync.db.transaction(["notes"], "readwrite")
     store = trans.objectStore "notes"
     request = store.delete(@id)
+
+    request.onsuccess = (e) =>
+      callback() if callback
 
 Model.Sync.Methods =
   extended: ->

      beforeSend: (xhr) ->
        xhr.setRequestHeader "Authorization", "Bearer " + localStorage.Token
    ).done((data) ->
      console.log data
    ).error (data) ->
      console.log "we should check if the bearer token is wrong"
      console.log "meta does not exist. uploading a new meta w/ every single file"

      promises = []
      $(Note.all()).each (i, e) ->
        e.loadNote (data) ->

          # make ajax request based on inputs from current loop element
          promises.push($.ajax(
              type: "put"
              crossDomain: true
              contentType: "application/octet-stream"
              url: "https://api-content.dropbox.com/1/files_put/sandbox/" + e.id + ".seed"
              data: data
              beforeSend: (xhr) ->
                xhr.setRequestHeader 'Authorization', 'Bearer ' + localStorage.Token
            )
          )

      # stuff
      $.when(promises).done ->
        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 ' + localStorage.Token
        ).done (data) ->
          console.log("all done! Delete the queue")
          localStorage.Queue = '{"Note": {}, "Notebook": {}}'


  connect: (fn) ->

      # Free up server resources. Cause why not.
      socket.disconnect()

  # The main syncing function.
  # It downloads the meta, then updates it to latest version as well as doing various other io.
  # It's magic. Trust me.
  doSync: ->

    # Downloads a meta file.
    $.ajax(
