Implmenting daemon mode