Making code slightly more DRY