i wonder if you could put all of this into a dataProvider and loop over it