Use set instead of list for faster lookup