                   (greedy-fire-actions s (first sources) possible-actions-fn)
 
                   (seq (get sources-by-type :bottom-up))
-                  (let [[p-var children] (apply max-key (comp tsi first) sources)] ;; min?
-                    (bottom-up-expand-actions s p-var (first children) child-var-map prevail-cvm possible-actions-fn))
+                  (let [[p-var children] (apply max-key (comp tsi first) (identity #_ canonicalize sources))] 
+                    (bottom-up-expand-actions s p-var children child-var-map prevail-cvm auxiliary-map possible-actions-fn)) 
                
                   :else (do (util/assert-is (empty? sources-by-type) "%s" [(do (print-state s) (clojure.inspector/inspect-tree (state/as-map s))
                                                                                s)])

  "Make an actino-set planning environment.  Switches are:
    check-deadlock?: check for cycles in precedence graph above and beyond lack of sources
    check-components?: check for disconnected components, rule out sources outside of goal comp
    edge-rule: :naive, :greedy, :sloppy, or :extra-sloppy.
       Naive means we stick exactly to the simple semantics of the vanilla actions.
       Greedy means we forget about reserving preconditions when free and we can fire right now (less branching).
       Sloppy means we ignore if preconditions are free, but require no action on them.
       Extra-sloppy means anything goes -- if you can execute ignoring commitments, go for it."
  ([sas-problem & {:keys [directed? greedy? deadlock? dead-vars? components?] :as m
                   :or   {directed? true greedy? true deadlock? true dead-vars? true components? false}}]
     (assert (every? #{:directed? :greedy? :deadlock? :dead-vars? :components?} (keys m)))
     (assert (= greedy? true))
     (let [edge-rule     (if greedy? :greedy :naive)

        [t f]
        [f t]))))

;; TODO: fix auxiliary var mapping.

;; TODO: improve
(defn get-auxiliary-map [sas-problem]
  (let [auxiliary-map (util/map-vals first (sas-analysis/auxiliary-vars sas-problem))]
    (assert (graphs/dag? auxiliary-map))
    auxiliary-map))




;; TODO: add assertions on precond var = effect var
;; Recall: greedy helps the most when, e.g., lots of passengers and not much room.
