Use orderIndex counter instead of searching each time.