Sync template branch infrastructure with master.

Change a few things to make it compatible with r151006 though.

Refs Github issue #22