ENH: Use template for inner loops and use stransfer