added code to respond to keyclicks