re-factored a little, consolidating some logic in setSelected