idea for refactoring out common code