working on the getSelection and event handling