Fixed function ordering for index to ensure stats are updated FIRST