Added CalculateMatrix()