Is there a reason that you clone these nodes for the template but then replace the originals with comments later anyway?
Wouldn't it be simpler and faster just to move them all into the template directly and just put one comment in their place?