Some preprocessor work and fixing up some of the document/template APIs.