debounced the key in a smarter way