better index counting