collection counting functionality