rewrite for npm/browserify