New requirement, checking matches with duplicates, implemented