split up xs into more readable parts, make behavior more consistent with
slice (not include the last integer)