another way to implement covariance