Changes to support both browser and node tests