minor changes trying to optimize the slicing code