added debounce. There's variable to set depending on the clock used