         init (env-util/initial-logging-state e)
         tla  (hierarchy-util/make-top-level-action e [(hierarchy/initial-plan henv)])]
     (binding [*subproblem-cache*    (HashMap.)]
-      (let [root (get-subproblem-root-pointer (state-set/make-logging-factored-state-set [init]) tla (constantly is/pos-inf))]
-        (refine-osp! root is/neg-inf nil)
-        (let [sum (osp-summary root nil)]
+      (let [root (get-root-osn (state-set/make-logging-factored-state-set [init]) tla (constantly is/pos-inf))]
+        (refine-osn! root is/neg-inf nil)
+        (let [sum (broom-summary root nil)]
           (println sum)
           (assert (not (refinable-summary? sum is/neg-inf)))
           (when-let [sol (optimal-solution sum)]

  (OutputSetNode. input-pair output-set is/pos-inf nil (atom +worst-summary+)
                  :terminal (atom terminal-summary) :terminal (atom +worst-summary+)))

(def +worst-osn+ (make-terminal-root-osn state-set/empty-lfss +worst-summary+))

(defn make-nonterminal-root-osn [input-pair output-set reward-bound init-summary init-plans]
  (assert (live? init-summary))
  (OutputSetNode. input-pair outputsetnode. reward-bound nil (atom +worst-summary+)
                  (atom init-plans) (atom init-summary) (atom {}) (atom +worst-summary+)))

(defn make-child-osn [parent-osn child-output-set]
  (OutputSetNode. (:input-pair parent-osn) child-output-set is/pos-inf parent-osn +best-summary+
                  (atom nil) (atom +worst-summary+) (atom {}) (atom +worst-summary+)))




  (when-let [[[_ out-set out-summary] out-nodes]
             (map-state
              update-pn-input
              (cons set-changed? (plan-node-output-set-and-summary (last prefix-nodes)))
              remaining-nodes)]
    (Plan. input-constraint input-set (concat prefix-nodes out-nodes) out-set out-summary)))

;; Need some meta-level basis to choose what to do...
;; For now, just pick a node at random, try to refine it, then try to split on its output.
(defn expand-plan [plan min-reward]
  (if (not (refinable-summary? (:summary plan) min-reward)) [plan]
      (let [{:keys [input-constraint input-set plan-nodes output-set summary]} plan
            [pre-nodes [ref-node & post-nodes]] (split-at (rand-int (count plan-nodes)) plan-nodes)
;            _ (println summary (count pre-nodes) (class ref-node) (count post-nodes))       
            [pre-set pre-summary]  (if (seq pre-nodes) (plan-node-output-set-and-summary (last pre-nodes)) [input-set zero-summary])
            sub-min-reward (- min-reward
                              (- (max-reward summary)
                                 (- (max-reward (:output-summary ref-node)) (max-reward pre-summary))))]
        (filter identity
                (for [next-pn (split-pn-output (refine-pn ref-node pre-summary sub-min-reward) pre-set pre-summary sub-min-reward)]
                  (propagate-plan-changes input-constraint input-set (concat pre-nodes [next-pn]) post-nodes
                                          (not= (:output-set next-pn) (:output-set ref-node))))))))




