Migrate to a TreeMap for determinism