Exception handling refactor.