#1925: made corrections as suggested by abeham in the code review. In particular hopefully corrected the calculation of the CDF.