Clean up solver code a bit.