Changed simplify algorithm