split unselect and select functions

and move the rather complex select logic in a seperate class
test the basics for select