reworked key handling, fixed focus related issues