Implement the solver.