Rewrite hook