Refactored for DRY