add debounce function