refactored methods into single responsibility