Refactored and renamed for readability.