Update to work with new matrix class