added keyboard handling