Optimizing web pages for speed and functionality