Changed the way retries are done to include maintenance mode