Move match function to helper.