optimized the solver cleanup code