Rewrote most of connection/protocol API