Replaced the hacky currentScript function with a standard HTML5 way of doing it