Further broke down the adapter to better isolate related logic.