move debounce function