Changed how the keyboard is handled to a cleaner version