some improvements to cumulative distribution function