refactoring and abstracting