more refactoring to support data with generics