changed the eliminateduplicates function