first version of the solver, untested