a bit more simple handshaking code