use targeted rewriting and factoring