General template cleanup.