Introduce handleSelection() and re-use select()