Refactor selection (still in progress).