DRYing out my code