Added new example file from the complete file.
Improved exception handling and logging.