Template refactoring: pull out a bunch of boilerplate from the build templates.