Updated for horizontal and vertical slice.