Added function to test for duplicates