              :submorphs [cont-path arc-path fork-path]},
               (+ cont-space fork-space)]))
 
+(defn attach-marker [branch-morph branch]
+  (let [marker (assoc-in history-marker [:morph :Position :x] @reverted-index)]
+    (update-in branch-morph [:submorphs] conj marker)))
+
 (defn render-branch
   ([branch]
-     ; initial call to first branch assume origin as starting point
-     (render-branch branch {:x 0 :y 0}))
+    (render-branch branch {:x 0 :y 0}))
   ([branch start-point]
      ; check if the current branch has any entries
-     (if-let [end (last @(branch :data))]
-        (if-let [cont (end :cont)] ; check for fork
-          (let [fork (end :fork)]
-            (render-fork @(branch :data) cont fork start-point))
-          (render-leaf branch start-point))
-        (render-stub branch start-point) ; this brunch has no entries yet
-      )
-  ))
-
-(defn render-tree [tree branch branch-callback]
+     (let [[bm sp] 
+       (if-let [end (last @(branch :data))]
+          (if-let [cont (end :cont)] ; check for fork
+            (let [fork (end :fork)]
+              (render-fork branch cont fork start-point))
+            (render-leaf branch start-point))
+          (render-stub branch start-point) ; this brunch has no entries yet
+        )]
+        [(if (and (contains? branch :id) ; we only attach markers to the root of the branch
+                  (is-on-current branch) 
+                  (> @reverted-index 0)) (attach-marker bm branch) bm) sp])))
+
+(defn refresh-view []
+  (let [[model _] (render-branch @rendered-tree)]
+      (swap! branch-view assoc :submorphs [merge-button (scale-branch-model model 400)])))
+
+(defn render-tree [tree branch branch-callback reverted]
   ; idea, walk to the leaves of the tree, and then start traversing
   ; from there and end at the root. This way we can make sure, that we
   ; reserve enough space such that all branches are neatly spaced apart)
   (when (not= @current-branch-ref branch) (prn "have to recolor!"))
+  (reset! rendered-tree tree)
   (reset! current-branch-ref branch)
   (reset! branch-callback-fn branch-callback)
-  (let [[model space] (render-branch tree)]
-      ; render stuff with om...
-      (prn container)
-      (swap! branch-view assoc :submorphs [(scale-branch-model model 400)])))
+  (reset! reverted-index reverted)
+  (let [[model _] (render-branch tree)]
+      (swap! branch-view assoc :submorphs [merge-button (scale-branch-model model 400)])))
+
+(def merge-button 
+  {:id "mergeButton"
+   :morph {:Position {:x 400 :y 100}
+           :onClick (fn [this]
+                      (reset! highlighted-branches {})
+                      (refresh-view))}
+                      ;(branch-merge/merge-staged-branches @rendered-tree))}
+   :shape {:Extent {:x 60 :y 15}
+           :BorderColor "darkgrey"
+           :Fill "lightgrey"}
+   :submorphs [{:morph {:MorphClass "Text"
+                        :TextString "Merge?"
+                        :Locked true}
+                :shape {:ShapeClass "Text"}}]})
 
 (def branch-view (atom
   {:id "branchView"
    :shape {:Extent {:x 400 :y 100}}
    :morph {:Position {:x 50 :y 50} :isDraggable true}
-   :submorphs []}))
+   :submorphs [merge-button]}))
 
 (om/root
   (fn [app owner]

            [om.dom :as dom :include-macros true]
            [cljs-workspace.morph 
              :as morphic 
              :refer [morph set-position set-fill set-extent add-morph remove-morph]]))

(enable-console-print!)
;; utilities to render a branching unrolled linked list

            [{; id nessecary? not for now... we do not alter the morph structure but just rerender it completely
             :morph {:MorphClass "Path"
                     :Position start-point
                     :onClick (fn [this] 
                                (@branch-callback-fn (cont :root))
                                false)}
             :shape {:ShapeClass "Path"
