Maybe this part should be kept out of the template?