Factor loader into a database storer and a batch loader

thanks for the input on this.