added rm_duplicates function