updated from A to loop over all SN and galaxy templates