refactored methods outside of event handlers