Changed chol2inv to solve for inverse.