Refactored matrix to use just a Vector.