Factor loader into a database storer and a batch loader

Good catch. Fixed in next commit.