better slice calculation