implemented a keyboard listener