Improving keybord events handling