merge pieter's z4 version