code for generics