averaging + covariance toolbox