Refactoring, add keyboard events