making sure that the script runs after page load