cleaned up solver code