refact the client manage