make rewrite.coffee more similar to rewrite.js