Replaced HashSets with LinkedLists