The keypress loop was simplified and its keyboard state buffer removed. KeyboardContext helper class added.