borrowed a bit more daemon boilerplate then I bargined for