Worked on making the solver algorithm more robust