implemented Selection and Keyboard events