add debounce helper
refactor script loading