Components/Keyboard.py: Refactor code