abstract out the matching part