zk refactoring