fix polyfill
improved js and testing