browser compatibility

This makes the index.js file loadable from a browser as well as node.