Trying to add a handshake but not working well