don't bother waiting for document ready as it's unneeded - a) should be immediately before closing body for performance, b) just adds complexity. Also move ajaxCache out of the way, distracting