refactor client manager