Add a global counter for branch in get_course_index()