change seg algorithm