refactor exceptions