Refactoring and allow for recursive file fetching