Shouldnt the out of bounds check be inclusive of the maximum indices? So ``` if x0 >= 0 and y0 >= 0 and z0 >= 0 and x1 <= X and y1 <= Y and z1 <= Z: ``` instead of ``` if x0 >= 0 and y0 >= 0 and z0 >= 0 and x1 < X and y1 < Y and z1 < Z ``` ?