generalize and simplify