   (GET "/vote-results" [] (page-vote-results))
   (GET "/projector" []
        "TODO: Stuff showing on the projector: 1. the task; 2. /teams; 3. /vote-results")
-  (context "/command" [] ; GameMaster posts commands here
-           (POST "show-task" [] "TODO")
-           (POST "start-brainstorming" [] "TODO")
-           (POST "start-voting" [] "TODO")
-           (POST "show-voting-results" [] "TODO"))
+  (context "/command" [] ; GameMaster posts commands here (TODO? check it really is gm)
+           (POST "/show-task" [] "TODO")
+           #_(POST "/start-brainstorming" [] (str (compare-and-set! state :oldstate :newstate))) ;; CURRENTLY NOT NEEDED
+           (POST "/start-voting" [] (str (compare-and-set! state :brainstorming :voting)))
+           (POST "/show-voting-results" [] (str (compare-and-set! state :voting :voting-finished))))
   (route/resources "/")
   (route/not-found "Not Found"))
 

        gm? (:gamemaster? session)]
   (cond
    (or gm? first-visitor?) {:session {:gamemaster? true},
                             :body (page-gamemaster)} ; TODO set cookie to remember the gamemaster
    (= @state :brainstorming) (page-team-registration)
    (= @state :voting) (if (has-voted? req)
                           "Thank you for your vote!"

       (fn [[id votes]] [:li votes " votes for team " id " with " (get @teams id)]) ; TODO show picture, format the list nicely
       results)])))

(defn- command-js [command] ; TODO include in a script element as a js fun, call it
  "Create JavaScript to perform a GM command in the background"
  (str "var xhr = new XMLHttpRequest();
      xhr.open('POST', '/command/" command "', true);
      xhr.onload = function(e) {console.log('done with " command "');}
      xhr.send();
"))

(defn page-gamemaster []
  "Control page for the GameMaster: 1. task info, 2. show task to others, 3. start brainstorming?, 4. start voting, 5. show number voted, 6. show voting results"
  (page
