 
 
 (defn- get-root-summarizer [inp-set fs]
-  (tree-summarizer (make-atomic-stub (atomic-name fs) inp-set nil)))
+  (tree-summarizer (make-atomic-stub (atomic-name fs) inp-set )))
 
 (def *lazy-cache* false) 
 (def *no-subsumption* false)

;; TODO: now this will never be true; how to avoid extra connections ?
(defprotocol TreeSummarizer
  (ts-stub [ts])
  (subsuming-tss [ts]) ; True tree summarizers subsuming this one.
  (add-subsuming-ts! [ts subsuming-ts]))  
  

(defn- make-tree-summarizer [stb]
  (let [subsuming-tss-list (ArrayList.)
        ret (traits/reify-traits [summaries/or-summarizable summaries/simple-cached-node]
              TreeSummarizer
              (ts-stub [ts] stb)
              (subsuming-tss [ts] (seq subsuming-tss-list))
              (add-subsuming-ts! [ts subsuming-ts]
                (util/assert-is (= (norm-name (stub-name stb)) (norm-name (stub-name (ts-stub subsuming-ts)))))                 
                (.add subsuming-tss-list subsuming-ts)
                (summaries/connect-subsumed! subsuming-ts ts)))]
    (when-not (get-stub-output stb)
      (summaries/connect! ret stb)
      (summaries/connect-subsumed! ret stb))


;; TODO: we keep reward for :blocked case
;; Note: weirdly, sometimes ignoring it helps. (not always)
(defn- make-atomic-subproblem [stb out-set reward status]
  (let [inp-set  (input-set stb)
        ri-fn    (fn [s ri] (get-stub (stub-name stb) ri))]
    (util/cond-let [subsuming-sp]
      (not (= status :live))
      (make-simple-subproblem
       stb out-set true
       (fn [s] (summary/make-simple-summary (min (summaries/get-bound s) reward) status s)) ri-fn)

      ;; TODO: order?
      (util/find-first #(not (terminal? %)) (subsuming-sps (tree-summarizer stb))) 
      (let [ret (make-simple-subproblem stb out-set false summaries/or-summary ri-fn)]
        (connect-and-watch! ret subsuming-sp
          (fn [sub-out]
            (connect-and-watch-stub-up! ret (refine-input sub-out inp-set) #(add-sp-child! ret %))))
        ret)
          
      :else 
      (let [ret (make-simple-subproblem stb out-set false summaries/or-summary ri-fn)]
        (doseq [child-name (map make-fs-seq-name (fs/child-seqs (second (stub-name stb)) inp-set))]
          (connect-and-watch-stub! ret (get-stub child-name inp-set) #(add-sp-child! ret %)))
        ret))))

;; Note: this is double-stage to lazily generate children.  Could be simpler single-stage.
(defn make-atomic-stub [nm inp-set]
  (let [state (atom :ready)]  ;; set to [out-set reward] after first eval, then :go after second.
    (traits/reify-traits [(simple-stub nm inp-set)]
      summaries/Summarizable
