add improvements to keyboard shortcuts and some code refactoring