rewrite framework