Added counter for number of elements