Added error handling
fixed logging message
Added syslog