Extract daemons code to a separate class