use a map with key lookups instead of a set