Refactor Daemon class