Changed the solver function