Refactoring zookeeper daemon