Refactoring in exception management