Moved all the logic to our reusable PopupKeyboard type.