Refactor `init` code (add support for older browsers).