Removed template header and added debounce for event handler