added clause 0<p<1