Changed wrapping to support browser and node