Added arguments for p0, std0, max_p