Keypress buffer and example use of it