First version of solver.