 
     (.on blob-stream "end"
       (fn []
+        (swap! app-state assoc :num-of-uploads (- (:num-of-uploads @app-state) 1))
+        (println "NUM OF UPLOADS NOW!" (:num-of-uploads @app-state))
         (if-not (empty? (:upload-queue @app-state))
           (let [next-file (first (:upload-queue @app-state))]
             (swap! app-state assoc :upload-queue (pop (:upload-queue @app-state)))
             (if-not (= next-file file)
-              (upload-file next-file))))))))
+              (if (> (:upload-slots @app-state) (:num-of-uploads @app-state))
+                (upload-file next-file)))))))))
 
 (.change (js/$ "#file-upload")
   (fn [e]
     (let [file (aget (.-files (.-target e)) 0)]
-      (swap! app-state assoc :upload-queue (conj (:upload-queue @app-state) file))
+      (swap! app-state assoc :upload-queue (vec (cons file (:upload-queue @app-state))))
+      (println "SHIT " (:num-of-uploads @app-state))
       (if (= 1 (count (:upload-queue @app-state)))
-        (upload-file file)))))
+        (if (> (:upload-slots @app-state) (:num-of-uploads @app-state))
+          (upload-file file))))))
 
 ; end stuff that should probably be cleaned up with react....
 

(defonce room-id (.getAttribute (. js/document (getElementById "roomid")) "data"))
(defonce socket (js/io))
(defonce current-sound-id "current-song")
(defonce app-state (atom {:signed-in? false
                          :messages []
                          :message-received? false

    false))

(defn upload-file [file]
  (swap! app-state assoc :num-of-uploads (+ 1 (:num-of-uploads @app-state)))

  (let [stream (.createStream js/ss)
        blob-stream (.createBlobReadStream js/ss file)]
    (println "File uploading!")
