Replaced use of lists with sets