for performance, change how types in a dataset counts are calculated