Refactor exceptions thrown