added touch support, improved key code fetch