Some small cleanup and a polyfill for newer versions of chrome