Conditional rewrite