inside p_min p_max outside