Added option to run as a daemon.
Started logging infrastructure.