Adding functionality to prevent duplicates in returned words