Added client code and basic handling at the client end.