Finish rewriting