General template tidy up.