implemented daemon mode