Refactored structure of exception