 (defn redirect-to [path]
   (set! js/window.location.href path))
 
-(defonce players (atom nil))
-
-(defn parse-json [json]
-  (walk/keywordize-keys (t/read (t/reader :json) @players)))
+(def players (atom nil))
 
 (defn load-players []
-  (GET "/list-players" {:handler (fn [res]
-                                   (reset! players res))}))
-
-(defn list-players []
-  (load-players)
-  [:ul
-   (map (fn [player] ^{:key player} [:li (:name player)]) (parse-json @players))])
+  (GET "/list-players"
+       {:handler (fn [res]
+                   (->> res
+                        (t/read (t/reader :json))
+                        (walk/keywordize-keys)
+                        (reset! players)))}))
 
 (def player1 (atom ""))
 (def player2 (atom ""))

                (map (fn [{:keys [name]}]
                       (when (not= @player1 name)
                         ^{:key name}[:option name]))
                     (parse-json @players))))]]]
    [select-game-pane]]
   (when (both-players-selected?)
     [:div

       (<= score points)))

(defn points [player]
  (- (:starting-score @game)
     (reduce + 0 (:rounds (get @game player)))) )

(defn record-score [player new-score]
  (swap! game #(update-in %1 [%2 :rounds] conj (js/parseInt %3))
