- changed from hashset to treeset to ensure determinism