begin the rewriting