DRYing out the code