Also changed the above function to use norm._cdf rather than erf