use key-code
extracted function