Setting default Z-direction. Added rd/wr for direction invert mask.