Work in progress about cleaning up template code.
Further WIP on template cleanup.
Finishing touches on template cleanup.