Refactored a little the solver class