Simplify code in DataLoader and minor clean-ups