fixed selection

got selection stuff into a working state, more stuff needs to be
separated out