Create Z-function