Refactored into a HWRP to for better code reuse.