rewrite

- browserify compatible
- separate scope