Refactor final_check_{match,target}().