Check for duplicates in a list