Exceptions and refactoring