Make "zigzag" example work with 3D arrays