added remove duplicates function