Cleaned up MatrixGenerator