refactoring toward removing duplication