Extract data loading logic in separate script