Rewrite template