working implementation of the polyfill