Refactor selection code.