Added setSelection function