use generics properly