refactoring for maintenance mode