added variance implementation