refactored client server