Add recursive replicate fn.