daemon and signal handler function added.