Exception handling refactored.