Refactored code to get document as file