Better handshake handling