added debug and daemonize