This is begging for a loop over a data structure. There's quite a bit of duplication here.