refactoring duplicates