Added some error handling on computing the number of standard deviations.