key down event optimize