Added assertion check for duplicates