Debugging, sockets and transports fixed and refactored.