Code re-org for diag module