Optimize images
First part of complete rewrite