More refactorings and more generics