change the code to be work client-server