refoactoring zookeeper