Move more things out of HTML templates.