switched from inverse to covariance matrix, added some gradient descent code