Refactored for clarity