   (condp = (q/key-as-keyword)
     :w (move-player-paddle state :up)
     :s (move-player-paddle state :down)
-    (keyword " ") (start-game state)
+    (keyword " ") (-> state
+                      (update-in [:is-running?] not)
+                      (start-game))
+    :r (init-game)
     state))
 
-#_(defn collision [state]
-  (let [ball-x (:x (:ball state))]
-       [ball-y (:y (:ball state))]
-       [new-y-dir (if (= + (:y-dir (:ball state)))
-                      -
-                      +)])
-  ;Check wall collision
-  (if (not (and (> ((:y-dir (state :ball)) ball-speed ball-y) (16.5))
-                (< ((:y-dir (state :ball)) ball-speed ball-y) (- 490 7.5))))
-    (as-> state state
-      (assoc-in state [:ball :y-dir] new-y-dir)
-      (if (= new-y-dir +)
-        (assoc state [:ball :y] 16.5)
-        (assoc state [:ball :y] 490))
-      (update-in state [:ball :y] (:y-dir (:ball state)) ball-speed))
-    (update-ball state)))
+(defn on-collision [state]
+  (let [ball-x (:x (:ball state))
+        ball-y (:y (:ball state))
+        new-y-dir (if (= + (:y-dir (:ball state))) - +)
+        _ (log (str (new-y-dir 0 1)))]
+    (log "on-collision")
+    ;Check wall collision
+    (if (not (and (> ((:y-dir (state :ball)) ball-speed ball-y)
+                     (+ 9 7.5))
+                  (< ((:y-dir (state :ball)) ball-speed ball-y)
+                     (- 490 7.5))))
+      (as-> state state
+        (assoc-in state [:ball :y-dir] new-y-dir)
+        (if (= (:y-dir state) -)
+          (assoc-in state [:ball :y] 50)
+          (assoc-in state [:ball :y] 450))
+        ;(update-in state [:ball :x] (:x-dir (:ball state)) ball-speed)
+        )
+      state)))
 
 (defn draw-game
   [state]
   ;(log "draw-game")
-  (log (:x-dir (:ball state)))
-  (q/rect-mode :corner)
-  (q/fill 255)
-  (q/rect 9 9 1082 482)
-  ;Create paddles and ball
-  (q/fill 0)
-  (q/rect-mode :center)
-  (q/rect ((state :player) :x) ((state :player) :y) 20 100)
-  (q/rect ((state :computer) :x) ((state :computer) :y) 20 100)
-  (q/ellipse ((state :ball) :x) ((state :ball) :y) ball-size ball-size))
+
+  (do
+    (q/rect-mode :corner)
+    (q/fill 255)
+    (q/rect 9 9 1082 482)
+    ;Create paddles and ball
+    (q/fill 0)
+    (q/rect-mode :center))
+
+  (q/rect ((state :player) :x)
+          ((state :player) :y) 20 100)
+  (q/rect ((state :computer) :x)
+          ((state :computer) :y) 20 100)
+  (q/ellipse ((state :ball) :x)
+             ((state :ball) :y) ball-size ball-size))
 
 (defn update-game
   [state]
-  (-> state
-    (update-ball)))
+  (if (:is-running? state)
+    (-> state
+        (update-ball)
+        (on-collision))
+    state))
 
 (q/defsketch pong-canvas
   :size [1100 500]

  :key-pressed handle-input
  :draw draw-game
  :update update-game
  :middleware [m/fun-mode])

(defn init-game []
  (log "init-game")

  (do
    (q/rect-mode :corner)
    ;Create background and outline
    (q/frame-rate 60)
    (q/smooth)
    (q/background 209 209 210)
    (q/fill 255)
    (q/no-stroke)
    (q/rect 9 9 1082 482)
    ;Create paddles and ball
    (q/fill 0)
    (q/rect-mode :center)
    (q/rect 59 250 20 100)
    (q/rect 1040 250 20 100)
    (q/ellipse 550 250 ball-size ball-size))

  {:player {:x 59 :y 250}
   :computer {:x 1040 :y 250}
   :ball {:x 550 :y 250}
   :is-running? false})

(defn move-player-paddle
  [state direction]
  ;(log "move-player-paddle")
  (if (= direction :down)
