checkpoint:  working on dynamic rewrite