Refactor DOMWindow into its own file