add daemon.h and documentation on functions