update the matching logic