implemented key input with no state