Modified the code to output messages if the program is not a daemon.