Added HTML sanitization and document ownership.