changed mz function to match value from paper