template merge