refactored larger methods into smaller methods