                                                       (get cursor "tracks")
                                                       (repeat id))]
                                      (om/build-all track-view cursors {:state state})))
-                            (om/build (:builder state) {:cursor cursor :id id :grid owner}
-                                      {:state state}))))))))
+                            (om/build (:builder-fn state) {:cursor cursor :id id :grid-state owner}))))))))
 
 (defn app-view [cursor _]
   (reify


(declare track-builder)

(defn play-builder [{:keys [cursor id grid]} _]
  (reify
    om/IRender
    (render [_]
      (dom/p #js {:style #js {:color "#999"}}
             (dom/span #js {:onClick #(om/set-state! grid :builder track-builder)} "{")
             (dom/span nil " play options ")
             (dom/span #js {:onClick #(om/set-state! grid :builder track-builder)} "}")))))

(defn synth-builder [{:keys [cursor id grid]} _]
  (reify
    om/IRender
    (render [_]
      (dom/p #js {:style #js {:color "#999"}}
             (dom/span #js {:onClick #(om/set-state! grid :builder track-builder)} "{")
             (dom/span nil " synth options ")
             (dom/span #js {:onClick #(om/set-state! grid :builder track-builder)} "}")))))

(defn sample-builder [{:keys [cursor id grid]} _]
  (reify
    om/IRender
    (render [_]
      (dom/p #js {:style #js {:color "#999"}}
             (dom/span #js {:onClick #(om/set-state! grid :builder track-builder)} "{")
             (dom/span nil " sample options ")
             (dom/span #js {:onClick #(om/set-state! grid :builder track-builder)} "}")))))

(defn track-builder [{:keys [cursor id grid]} owner]
  (reify
    om/IInitState
    (init-state [_]
      {:track-builder-expanded false})
    om/IRenderState
    (render-state [_ state]
      (if-not (:track-builder-expanded state)
        (dom/p #js {:onClick #(om/set-state! owner :track-builder-expanded true)
                    :style #js {:color "#999"}}
               "{}")
        (dom/p #js {:style #js {:color "#999"}}
               (dom/span #js {:onClick #(om/set-state! owner :track-builder-expanded false)} "{")
               (dom/span #js {:onClick #(om/set-state! grid :builder play-builder)} " play ")
               (dom/span #js {:onClick #(om/set-state! grid :builder synth-builder)} " synth ")
               (dom/span #js {:onClick #(om/set-state! grid :builder sample-builder)} " sample ")
               (dom/span #js {:onClick #(om/set-state! owner :track-builder-expanded false)} "}"))))))

(defn grid-view [id owner]
  (reify
    om/IInitState
    (init-state [_]
      {:grid-expanded false
       :builder track-builder})
    om/IRenderState
    (render-state [_ state]
      (let [cursor (get (om/observe owner (grids)) id)]

                                            (get cursor "beats")
                                            (repeat id))]
                           (om/build-all cell-view cursors {:state state})))))
                (dom/td #js {:style #js {:color "#999" :paddingRight "10px"}} "{~}")
                (dom/td nil
                        (when (= "grid" (get cursor "type"))
                          (let [id (get cursor "id")
