refactoring and separating concerns