 
 (defn mk-recent-tree-at-inner-path
   [path path-parents tree-atom]
-  (if (= (count path) 1) ;; TODO is this the right way to detect root?
+  (if (= (count path) 0) ;; TODO is this the right way to detect root?
     (let [new-tree (get-temp-root-tree path)]
       (push-to-tree-atom!  new-tree
                            tree-atom)
       new-tree)
-    (let [parent (produce-recent-tree-atom! (find-closest-parent path
-                                                                 path-parents)
+    (let [parent (produce-recent-tree-atom! (find-closest-parent path path-parents)
                                             path-parents
                                             tree-atom)
           new-tree (-> (trace/mk-tree :parent @parent)


(defn record-trace-tree!
  [tree-atom root-path]
  (let [children (some-> (@tree-atom root-path)
                         deref-children
                         :children
                         deref)]

                        src-map
                        fn-meta
                        path
                        path)]
    (layer-xpansion-maps xmap
                         {:path-parents {path path-parent}
                          :templates {path (mk-tree-template src-map
