fix keydown to keyup
some cleanup