added an invert_z option for morse stuff