Updated logging and error reporting