 
 (defn sorted-map-from-value-list [unsorted-map value-list]
   (let [inverted (s/map-invert unsorted-map)]
-    (reduce (fn [acc value]
-              (let [key (inverted value)]
-                (if (nil? key) #spy/p value)
-                (assoc acc key  value)))
-            (sorted-map) value-list)))
+    (-> (reduce (fn [acc value] (assoc acc (inverted value) value))
+                (sorted-map) value-list)
+        (dissoc nil))))
 
 (defn map-vals [t m]
   (into (empty m) (map (fn [[k v]] [k (t v)]) m)))
 
 (defn with-children [context]
   (if (zero? (.getChildCount context))
-    {:object context}
+    {:object context
+     :text   (.getText context)}
     {:object context 
-     :children (map-vals
-                 with-children
-                 (sorted-map-from-value-list
-                   (do-mapify context)
-                   (.children context)))}))
+     :children (let [sorted (sorted-map-from-value-list (do-mapify context)
+                                                        (.children context))]
+                 (if (empty? sorted)
+                   (map with-children (.children context))     
+                   (map-vals with-children sorted)))}))
 
 (defn main []
   (let [parser (-> (ANTLRFileStream. "resources/hiWaitBye.js")

    (.setBuildParseTree parser true)
    (.program parser)))

(with-children (main))


            [clojure.set :as s])
  (:import [org.antlr.v4.runtime ANTLRFileStream CommonTokenStream ParserRuleContext]
           [clojure.lang Reflector]))

(defn find-branch-method-names [context]
  (->> context
