added unconstrained pass before rewriting