Clearer handling of keylistener setup.