More refactoring of api/transport