adding updated debounce from @dlongley