refactored methods into class