do you need the `TreeSet` here or can this be a `HashSet`? The one you use also maintains order?