works in browser and node