Refactored code to have modular data loader