Changed how the inline javascript is loaded, it waits for all DOM Content is loaded (using DOMContentLoaded event listener) before executing the script