                                         :style #js {:color "#999"}}
                                    (str "[-] " id " (" (get cursor "bpc") ")"))
                             (apply dom/table nil
-                                   (let [cursors (map #(hash-map :cursor %1 :id %2)
+                                   (let [cursors (map #(hash-map :cursor %1 :id %2 :index %3)
                                                       (get cursor "tracks")
-                                                      (repeat id))]
+                                                      (repeat id)
+                                                      (range))]
                                      (om/build-all track-view cursors {:state state})))
                             (om/build track-builder {:cursor (get cursor "tracks")
                                                      :id id

                     (dom/span #js {:onClick commit} " commit? ")
                     (dom/span nil "}")))))))

(defn grid-view [id owner]
  (reify
    om/IInitState


(declare grid-view)

(defn track-editor [{:keys [cursor id index set-state-ch]} owner]
  (reify
    om/IInitState
    (init-state [_]
      {:state :init})
    om/IRenderState
    (render-state [_ state]
      (let [delete #(let [grid (get (om/observe owner (grids)) id)]
                      (om/transact! (get grid "tracks") 
                                    (fn [s] 
                                      (print index)
                                      (vec (concat (subvec s 0 index)
                                                   (subvec s (+ 1 index) (count s)))))))]
        (condp = (:state state)
          :init (dom/p #js {:style #js {:color "#999"}}
                       (dom/span #js {:onClick #(om/update-state! owner (fn [s] (merge s {:state :open})))} "{~}"))
          :open (dom/p #js {:style #js {:color "#999"}}
                       (dom/span #js {:onClick #(om/update-state! owner (fn [s] (merge s {:state :init})))} "{-")
                       (dom/span #js {:onClick delete} " delete? ")
                       (dom/span nil "}")))))))

(defn track-builder [{:keys [cursor id set-state-ch]} owner]
  (reify
