working for keyup and keydown