now works in browser as well as node