Renamed extend_match_with_res to extend_match