       (.getContext "2d")))
 
 (defn draw-grid
-  [grid cell-size]
+  [grid]
   (let [ctx (get-ctx)
         width (count (first grid))
-        height (count grid)]
-    (.clearRect ctx 0 0 (* width cell-size) (* height cell-size))
+        height (count grid)
+        cell-width (/ canvas-width width)
+        cell-height (/ canvas-height height)]
+    (.clearRect ctx 0 0 canvas-width canvas-height)
 
     (set! (.-fillStyle ctx) "#CCC")
 

                         @num-iterations
                         @smoothing-passes)
      ::generate/grid
      (draw-grid (/ canvas-width grid-width))))

;; Reagent components

(defn row [a-row y]
  [:div.row
   (for [[x cell] (map-indexed vector a-row)]
     ^{:key ["cell" x y]} [:div.cell {:class (name cell)}])])

(defn grid [visualization-state]
  [:div.world
   (conj (for [[y a-row] (map-indexed vector (@visualization-state ::generate/grid))]
           ^{:key ["row" y]} [row a-row y])

         (when-let [[x y] (@visualization-state ::active-cell)]
           ^{:key "active-cell"} [:div.cell.active {:style {:left (* cell-size x)
                                                            :top  (* cell-size y)}}]))])

(defn slider [an-atom min max step callback]
  (let [_ @an-atom]


          (doto ctx
            (.beginPath)
            (.rect (* x cell-width) (* y cell-height) cell-width cell-height)
            (.fill)))

        (recur (if (= (dec x) width) 0 (inc x))
