Major refactor of existing functionality; added logging.
Add try catch around program entrypoint to save log if there's an otherwise unhandled exception.
Additional refactoring; fixed command line attributes.