Improve selection handling.