Added syslog support and some minor code cleanups
Close the syslog at exit