Complete version of the solver.