Refactoring and exception handling.