generics refactoring