removed calculation of standard deviation twice