Updated code to pass tests on phantom without polyfill