Refactored file loader