Refactoring API wrapper code.