adding message class and fixed handshake