Tweaks to the index selection logic.