added removeDuplicates method