refactoring for sample/libzen