Refactor JavaScript loader into its own method (loadScript)