Explain how Document functions.