Adding solution for Handshake problem