Refactor to separate Solver