better keyboard handling