Extracted current file retrieval into a separate method