Refactor the D3 API Client