refactoring: less repetition