finished p_wrapper