refactored data loading