started with z4, added classes, refactor function generating calls