merge duplicates function
duplicate merge