Cleaning up Matrix class