Seperated daemon code