Adding exception logging.
Adding imports.
Cleaning up tests.