Fixed up the rewriting