Updated Matrix class