simplify code
add test for slices