       (move-indicator-to i))))
 
 (defn add-new-branch [branch]
-  (let [new-branch-morph (branch-morph 
-                          5 (+ 5 (* branch-height @branch-count)) 
+    (let [new-branch-morph (branch-morph 
+                          5 (+ 5 (* branch-height (dec @branch-count))) 
                          (- diagram-width 0) branch-height branch)]
-    (swap! branch-count inc)
-    (add-morph history-view "wrapper" new-branch-morph)
-    (set-extent history-view "wrapper" {:x diagram-width :y (+ 10 (* branch-height @branch-count))})
-    (switch-to-branch branch)
-    (.log js/console (morphic/dict->js @history-view))))
+      (add-morph history-view "wrapper" new-branch-morph)
+      (set-extent history-view "wrapper" {:x (+ diagram-width 10) :y (+ 10 (* branch-height @branch-count))})
+      (switch-to-branch branch))
+    (.log js/console (morphic/dict->js @history-view)))
 
 ;; snapshot the state when it is changed:
 

           :Extent {:x 4 :y branch-height }}})

(defn branch-morph [posX posY width height branch]
         {:id (hash branch) ;; use the hashed version of branch for uuid
          :morph {:Position {:x posX :y posY}
                  :onClick (fn [e] (switch-to-branch branch))}
          :shape {:Fill "green"
                  :BorderColor "darkgreen"
                  :Extent {:x width :y height}}
           :submorphs [history-indicator]})

(def history-view
  (atom {:id "wrapper"

      (branch-at @reverted-to n)
      ; else just append to history
      :else
      (let [b @(@current-branch :data)]
        (when-not (= (last b) n)
          (swap! (@current-branch :data) conj n))
        (let [c (len @(@current-branch :data))]
            (prn (str c " Saved " (pluralize c "State")))))))

; (om/root
;   (fn [app owner]
