Updated to use constructors and polyfills.