rewriter got a little less stupid