Refactored & renamed code for semantic clarity.