clean up some code and make communications from client line up