Improved handling of keystrokes and speed setting