Changed the mean calculation