     (cons (first form)
           bods)))
 
+(defn quote* [x] `'~x)
+
 (defn prep-traced-bods
-  [r]
-  {:templates ['$0-0 {}]
-   :path {'$0-1 ['$$$ '$$$]}
-   :bods '(([] 123))
-   :r r}
-  :NOT-IMPLEMENTED)
+  [traced-bods]
+  {:templates (->> traced-bods
+                   (map :templates)
+                   (apply merge)
+                   (mapcat (fn [[k v]]
+                             [(path->sym k) (-> v
+                                                (update-in [:ns] quote*)
+                                                (update-in [:name] quote*)
+                                                (update-in [:parent-name] quote*)
+                                                (update-in [:form] quote*)
+                                                (update-in [:xpanded-frm] quote*)
+                                                (assoc :path-parents '$$paths))])))
+   :path-parents (->> traced-bods
+                      (map :path-parents)
+                      (apply merge))
+   :form (map (fn [m]
+                `(~(:args m)
+                  (let [~'$$ (atom [])]
+                    ~@(apply list (:form m)))))
+              traced-bods)})
 
 (defn xpand-fn*
   [form parent-fn-meta]

                  (map-indexed (partial xpand-body
                                        parent-fn-meta))
                  prep-traced-bods)]
    `(let [~'$$p ~(:paths bods)
           ~@(:templates bods)]
       (fn ~@(:bods bods)))))

(defn get-fn
  [[d s f & r]]

  :NOT-IMPLEMENTED)

(defn mk-tree-template
  [src-map frm-meta fn-meta path & {:keys [macro?]}]
  (let [sub-src-map (->> path
                         rest
                         (remove #{:macro})
                         src-map)
        form (if macro?
               (:orig sub-src-map)
               (:x sub-src-map))]
    {:inner-body-idx (first path)
     :inner-path path
     :name (if (seq? form)
             (first form)
             form)
     :form form
     :macro? macro?
     :parent-name (symbol (format "%s/%s"
                                  (-> fn-meta :ns str)
                                  (:name fn-meta)))
     :ns (-> fn-meta :ns str symbol)
     :xpanded-frm (:x sub-src-map)
     :src-pos (select-keys frm-meta [:line :column :end-line :end-column :file])}))

