Introduce rewrite API