Refactor mathing logic to reject duplicate matches