     (aset canvas "height" (* sq-size 22))))
 
 (defn draw-cell
-  [ctx x y]
-  (let [color (get-cell-color (read-board x y))
+  "Draw the given cell of the given board."
+  [ctx x y board]
+  (let [color (get-cell-color (read-board x y board))
         left (* sq-size x)
         top  (* sq-size y)]
-
     (aset ctx "fillStyle" color)
     (.fillRect ctx left top sq-size sq-size)))
 
-(defn draw-board []
+(defn draw-board
+  "Draw the given board to the canvas."
+  [board]
   (let [canvas (.getElementById js/document "canvas")
         ctx    (.getContext canvas "2d")]
-    (doall (for [x (range 10) y (range 22)]
-      (draw-cell ctx x y)))))
+    (doseq [x (range 10) y (range 22)]
+      (draw-cell ctx x y board))
+    nil))
 
 (defn auto-refresh
   "Automatically refresh the page whenever a cljs file is compiled."

(defn init []
  (connect-repl)
  (size-canvas)
  (draw-board)

  (auto-refresh)
  )


(defn coord-empty?
  "Determines if the given coordinate on the board is empty."
  [x y board]
  (zero? (read-board x y board)))

(defn coord-fits?
  "Determines if the given relative coordinate fits at the position on the board."
  [[cx cy] x y board]
  (let [abs-x (+ x cx)
        abs-y (+ y cy)]
    (and (coord-inside? abs-x abs-y)
         (coord-empty? abs-x abs-y board))))

(defn piece-fits?
  "Determines if the given piece will collide with anything in the current board."
  [piece x y board]
  (every? #(coord-fits? % x y board) piece))

; ------------------------------------------------------------
; DRAWING FUNCTIONS
