Refactored for readability.