Used sets as a better data structure in some cases