use hashset to remove duplicates