daemonizing staff mooved to separated file, refactoring