mask_inside_slices and mask_outside_slices amended to operate with None ends.