Changed implementation to set instead of list to remove duplicates.