first part of replicating template