Added error logging.
Formatting.