Did some work on the solver function