Refactor `p_wrap` utility.