added debounce to keybaord fucntion