Specifically, didn't want to mess with the global scope variables and overwrite them for cleanliness, so the whole script logic is inside of a closure for different loading envs