improved keydown/keyup algorithms againgit add -A!