matches with duplicates
refactor