Made code a little more DRY.