reorganizes some code, and makes the selection mechanics a little better...