improved selection, bug fixes