     (swap! state assoc :position [x ny])
     (lock-piece!)))
 
+(defn change-theme!
+  "Changes the boards theme"
+  [theme year platform event]
+  (.preventDefault event)
+  (swap! state assoc :theme theme)
+  (.html ($ "#theme") year)
+  (.html ($ "#theme-details") platform)
+  (aset js/localStorage "theme" theme))
+
+(defn load-theme!
+  "Loads a theme if theres one saved in localStorage"
+  []
+  (if-let [theme (aget js/localStorage "theme")]
+    (swap! state assoc :theme theme)
+    ""))
+
 (defn add-key-events
   "Add all the key inputs."
   []

        key-name #(-> % .-keyCode key-names)
        key-down (fn [e]
                   (case (key-name e)
                     :one (do
                            (swap! state assoc :theme 0) 
                            (.preventDefault e)
                            (.html ($ "#theme") "1984")
                            (.html ($ "#theme-details") "Electronika 60"))
                     :two (do 
                            (swap! state assoc :theme 1) 
                            (.preventDefault e)
                            (.html ($ "#theme") "1986")
                            (.html ($ "#theme-details") "MS DOS"))
                     :three (do 
                              (swap! state assoc :theme 2) 
                              (.preventDefault e)
                              (.html ($ "#theme") "1986")
                              (.html ($ "#theme-details") "Tengen/Atari Arcade"))
                     :four (do 
                             (swap! state assoc :theme 3) 
                             (.preventDefault e)
                             (.html ($ "#theme") "1989")
                             (.html ($ "#theme-details") "Gameboy"))
                     :five (do 
                             (swap! state assoc :theme 4) 
                             (.preventDefault e)
                             (.html ($ "#theme") "1989")
                             (.html ($ "#theme-details") "NES"))
                     :six (do 
                            (swap! state assoc :theme 5) 
                            (.preventDefault e)
                            (.html ($ "#theme") "1989")
                            (.html ($ "#theme-details") "Sega Genesis"))
                     :seven (do 
                              (swap! state assoc :theme 6) 
                              (.preventDefault e)
                              (.html ($ "#theme") "1998")
                              (.html ($ "#theme-details") "Gameboy color"))
                     ;; TODO: Reorder themes here
                     :eight (do 
                              (swap! state assoc :theme 7) 
                              (.preventDefault e)
                              (.html ($ "#theme") "2000")
                              (.html ($ "#theme-details") "TI-83"))
                     :nine (do 
                             (swap! state assoc :theme 8) 
                             (.preventDefault e)
                             (.html ($ "#theme") "2002")
                             (.html ($ "#theme-details") "Flash"))
                     :zero (do 
                             (swap! state assoc :theme 9) 
                             (.preventDefault e)
                             (.html ($ "#theme") "2012")
                             (.html ($ "#theme-details") "Facebook"))
                     nil)
                   (if (:piece @state)
                     (case (key-name e)

(defn init []

  (init-state!)
  (load-theme!)
    
  (size-canvas! "game-canvas" empty-board cell-size rows-cutoff)
  (size-canvas! "next-canvas" (next-piece-board) cell-size)

