updated and fixed constructors for client and server