             [(reverse (:act-seq (meta state))) (:reward (meta state))]
             (do (when-not (.contains closed state)
                   (.add closed state)
-                  (doseq [a (stratified-applicable-actions last-a state tsi actions)]
+                  (doseq [a (strat-actions last-a state)]
                     (when (env/applicable? a state)
                       (let [[ss sc] (env/successor a state)]
                         (queues/pq-add! q [a ss] (- c sc))))))


;; (let [e (force (nth ipc2-logistics 3)) ]  (println (time (run-counted #(stratified-search e)))))

;; Logistics results (# states) to match table.
;; 5-2: 19771
;; 6-1: 226446
;; 4-2: 365709

    (actions state)))

(defn stratified-search [sas-problem]
  (let [improved? false
        q       (queues/make-tree-search-pq)
        closed  (HashSet.)
        actions (env/actions-fn sas-problem)
        causal-graph  (sas-analysis/standard-causal-graph sas-problem) 
        pre-var-map   (util/map-vals #(set (map first %)) (group-by second causal-graph))
        tsi           (graphs/topological-sort-indices (remove #(apply = %) causal-graph))
        goal    (env/goal-fn sas-problem)
        init    (env/initial-state sas-problem)
        strat-actions (if improved?
                        (fn [last-a state] (improved-inf-stratified-applicable-actions last-a state pre-var-map actions))
                        (fn [last-a state] (inf-stratified-applicable-actions last-a state tsi actions)))]
    (queues/pq-add! q [nil init] 0)
;    (println causal-graph tsi pre-var-map)
    (loop []
      (when-not (queues/pq-empty? q)
        (let [[[last-a state] c] (queues/pq-remove-min-with-cost! q)]
