cleaned up comments
added mean and variance calculations