Refactored active_doc for readability.