Replaced $() with document.querySelector(), simplified search for script tag