added keyboard handling snippet