Added calculation of variance