Is there a reason for switching back from document to window.location? I'm fine with either one of those.