Add remove_duplicates function