Refactor Solver.