         (if-not (empty? next-key-set)
           (recur next-key-set
                  (titanic-generate base-set next-key-set)
-                 (sort (fn [a b]
-                         (= (get set-weight a)
-                            (weight-minimum [(get set-weight a) (get set-weight b)])))
-                       (concat next-key-set keys)))
+                 (map first
+                      (sort (fn [[_ a] [_ b]]
+                              (weight-order a b))
+                            (map #(vector % (set-weight %))
+                                 (concat next-key-set keys)))))
           (distinct (map closure keys)))))))
 
 ;;;

 "Implements the TITANIC algorithm. Note that this implementation is
 not tune for speed but for flexibility.")

;;; Pragmatics

(defmacro- set-val!

  (titanic (attributes context)
           (supports context 0)
           1.0
           <=))

(defn titanic-iceberg-intent-set
  "Computes the iceberg intent set for given context and minimal
