Refactored for cleanliness