@empo: Excellent! So the basic approach is to handle the critical 'item's (where @cols changes) in the main loop, and handle the adjacent nodes to these in the recursive template call. I've used your approach and made a few changes to make the code simpler, but this works great!