Added/updated polyfills to improve compastability

It's very slow but now it works in Opera.