what is slice method does