Update to use unsafeWindow (part 2 of 2)