Added interleave function