           [deck3 player2 disc3] (deal (deal [deck2 player1 disc2] :up) :up)]
       (swap! game assoc :playing true :discard-pile disc3 :player-hand player2
              :dealer-hand dealer2 :deck deck3 :dealer-feedback "" :player-feedback "")
-      (if (immediate-win player2 dealer2)
+      (if (immediate-win dealer2 player2)
         (do
           (swap! game assoc :dealer-hand (reveal dealer2))
           (end-game dealer2 player2))))))
 
-(defn hit-me [event]
+(defn hit-me
+  "Deal a card face up to the player, and evaluate the hand.
+  If the player went bust, end the game."
+  [event]
   (let [{:keys [deck discard-pile dealer-hand player-hand]} @game
         [deck2 player2 discard2] (deal [deck player-hand discard-pile] :up)
         [total status] (evaluate-hand player2)]
     (swap! game assoc :player-hand player2 :deck deck2 :discard-pile discard2)
     (if (= status :bust) (end-game dealer-hand player2))))
 
-(defn stand [event]
+(defn stand
+  "Player is satisfied with hand. Reveal the dealer's hand,
+  then deal cards one at a time until the dealer has to stand
+  or goes bust."
+  [event]
   (let [{:keys [deck dealer-hand player-hand discard-pile]} @game
         dhand (reveal dealer-hand)]
     (swap! game assoc :dealer-hand dhand)

              :on-change change-bet
              :value current-bet}]
     " Current money: $" player-money
    "\u00a0"
    [:input {:type "button"
             :value "Recharge money"
             :on-click recharge-money
             :style {:display (if (= player-money 0) "inline" "none")}}]]]))

(swap! game assoc :deck (into [] (shuffle (range 0 52))))
(reagent/render-component [tableau] (.getElementById js/document "tableau"))

                   :height "133px"
                   :width "98px"}}]))

(defn show-cards
  "Show all the cards in a hand."
  [hand]
  (into [] (concat [:div {:class "cards"}]
                   (map (fn [x] (card-image hand x)) (range 0 (count hand))))))

(defn tableau
  "Display the playing area (the tableau)."
  []
  (let [{:keys [dealer-hand player-hand playing dealer-feedback player-feedback
                player-money current-bet]} @game]
  [:div
   [:h2 "Dealer’s Cards " [:span {:class "dealerFeedback"} dealer-feedback]]
   [show-cards dealer-hand]
   [:hr]
   [:h2 "Your Cards " [:span {:class "playerFeedback"} player-feedback]]
   [show-cards player-hand]
   [:p
    [:input {:type "button"
