now works for browser and node