Rewrote transport layer to solve connection/reconnection issues + bug fixes