client main code