Cleaned up solver.