Improved matrix manager and the model class.