changed window to document