           (.createSound js/soundManager #js {:id track-id
                                              :type "audio/mpeg"
                                              :url (.-result reader)
-                                             :autoLoad true}))
+                                             :autoLoad true
+                                             :whileloading while-loading
+                                             :onload while-loading}))
         (.play (:current-sound @app-state)
                #js {:whileplaying while-playing
                     :onfinish on-finish
                     :onplay #(.setPosition (:current-sound @app-state)
                                            position)})))))
+
+(defn destroy-track [track-id]
+  (if (or
+        (= 0 (.-readyState (:current-sound @app-state)))
+        (= 1 (.-readyState (:current-sound @app-state))))
+    (do
+      (println "HAPPENING!!!")
+      (swap! app-state assoc :tracks-to-delete (conj (:tracks-to-delete @app-state) track-id)))
+    (.destruct (:current-sound @app-state))))
 
 (.on socket "sign-in-success"
   (fn []

  (println "Song has finished!")
  (.emit socket "track-complete"))

(defn play-track [track-id position]
  (let [reader (new js/FileReader)
        song-blob (get (:music-files @app-state) track-id)]

(.on socket "track-change"
  (fn [track-id]
    (println "CHANGING TO TRACK " track-id)
    (let [last-current-track-id (:current-track-id @app-state)]
      (swap! app-state assoc :current-track-id track-id)

      (if-not (or
                (= last-current-track-id track-id)
                (nil? last-current-track-id))
        (destroy-track last-current-track-id)))

    (if (nil? (get (:music-files @app-state) track-id))
      (.emit socket "file-download-request" track-id)
