Refactored for clarity.