updated remove duplicates function -- fixed splic