minor refactor, added options to the rewriter