refactor ClientListener