Misc cleanup and IE compatibility fixes / polyfills