Adding Solver class. Merging TreeNode and Matrix.