Updated Server and Client Code