Checking for duplicates working