expand template implementation