Replacing debounce counter for timeout function

As pointed out in the issue, I replaced the debounce counter with a timeout function.