Added tests and slightly refactored the transport.