I see a lot of copied code from templates above. Would it be possible to abstract this into a separate .tpl file for inclusion?