added removeDupes function