Integrated script manager and fixed a race condition in the resource loader.