Refactor plan to prepare for index selection.