refactor data loading