DRYing up the view code