Daemon mode refactor.