main code of solvers