Implement keyup events, plus a few fixes.