MainScript cleaned up

Merge it