move stuff around
more fine grained error handling
no more asserts in handshake