added removeDuplicate function