Handle OperationalErrors in exception logging
Do some minor code cleanup