     (make-output-collecting-stub stub)
     stub))
 
-;; TODO: unwrap
-
+;; TODO: can we safely unwrap?
+;; Does not work --
 (defn get-base-stub [stub]
   (if (= :SA (first (stub-name stub)))
     (get-base-stub (get-inner-sp (tree-summarizer stub)))

              (simple-stub [:OS (stub-name inner-stub) in-set] in-set)])]
    (connect-and-watch! ret inner-stub #(set-stub-output! ret (make-output-collecting-subproblem ret %)))
    ret))

;; TODO: check out set equality issues...
;; TODO: remove extra layers here ?  Don't actually seem to help.

    (connect-subsuming! ret subsuming-sp)
    (output-wrap ret)))

;; Note: we must always wrap in S-A stub to get effects out of logger. 
;; TODO: do something more with subsuming?
(defn- get-atomic-stub [subsuming-sp inp-set function-set]
  (let [full-name [:Atomic (fs/fs-name function-set)
                   (if *state-abstraction* (fs/extract-context function-set inp-set) inp-set)]
        name [:Atomic (fs/fs-name function-set)]]
    (if-let [^HashMap dc *decompose-cache*]
      (if *state-abstraction*
        (let [logged-inp (fs/get-logger function-set inp-set)
              stub (util/cache-with dc full-name (make-atomic-stub name subsuming-sp logged-inp function-set))]
          (make-state-abstracted-stub stub inp-set))   
        (util/cache-with dc full-name (make-atomic-stub name subsuming-sp inp-set function-set)))
     (make-atomic-stub name subsuming-sp inp-set function-set))))


