added covariances function