Split off some template stuff for easier updating.