More tidying up, including a new PageRenderer class which handles the rendering of the page.