added 2 more arguments to slice_array method