getSelection improved