simplify code
more consistent slice usage