Improved timing issues for key pressing.