selected is now a pointer not a number

Simplifying the code dramatically.