Moved stencils from linear to 3d access