split template code up into parts