Tidy up templating and page variables