Handshaking between client and server ; also got rid of the singletons