Updated mainhub to handle handshaking