Refactoring for TrainLoader