Added doctests. Fix slice.