         new-upload-slots (:upload-slots new-state)
         active-uploads   (:active-uploads new-state)
         inactive-uploads (:inactive-uploads new-state)
-        uploads (:uploads new-state)]
+        uploads          (:uploads new-state)]
     (println "UPLOADS!" uploads)
     (cond
       (and (< old-upload-slots new-upload-slots)

                               (get (:uploads new-state) upload-id))
        old-upload-state (first upload-diff)
        new-upload-state (second upload-diff)]
    (if (nil? old-upload-state)
      (if (:started? new-upload-state)
        :started
        nil)
      (if-not (nil? new-upload-state)
        (let [k (first (keys new-upload-state))
              v (first (vals new-upload-state))]

(add-watch app-state/app-state :upload-slots upload-slots-watch-fn!)

(defn upload-removed-watch-fn! [_ _ old-state new-state]
  (let [deleted-upload-ids (clojure.set/difference (set (keys (:uploads old-state)))
                                                   (set (keys (:uploads new-state))))]
    (if-not (empty? deleted-upload-ids)
      (let [active-uploads   (vec (remove (set deleted-upload-ids) (:active-uploads new-state)))
            inactive-uploads (vec (remove (set deleted-upload-ids) (:inactive-uploads new-state)))
            uploads (:uploads new-state)]
        (if-not (empty? inactive-uploads)
          (swap! app-state/app-state
                 merge
                 {:active-uploads (append-upload active-uploads
                                                 (first inactive-uploads))
                  :inactive-uploads (drop-first-upload inactive-uploads)
                  :uploads (merge uploads {(first inactive-uploads)
                                           (start-upload (uploads (first inactive-uploads)))})}))))))

(add-watch app-state/app-state :upload-removed upload-removed-watch-fn!)

