refactor client&server