Better slicing code