Added support for key codes