Refactored and renamed for clarity