Refactored for future expansion.