added index counting