Refactored adapter for readability.