DRYs up some code.