refactoring: removed duplication