refactoring. creating exceptions