a helper that collects class count stats