partial generic refactoring