Wrap dynamic script to avoid globals