simplify quadratic solver code