Brought back in changes from pre-undo-stash, time to re-add index support