Refactoring and generics