Fixed a lot of the Daemonizing and added logging functionality