Put all code that runs at the start of the main file inside a indexLoadScript function