some refactoring before building cluster-client