updated the slice method