Pact rewrite