Log exceptions.
Log exceptions.
Log exceptions.
Log exceptions and minor refactorings.