Added removeDuplicates function