Simplify algorithm