added ability to specify optional zfield for third dimension in output