Updated the timing of reading javascript files