Optimize image and rearrange script loads