Added 3d through 2d + iteration over other dimension