streamlined computation of variance