DRYing up some list code