General cleanup, trim polyfill