Clean up quadratic solver a bit.
Simplify quadratic solver p==2 case.