factor out keyboard