Move selected handling outside of creation loop