Make npdm and transition npdm well-organized. Clean up transition pdm
based on old onepdm and twopdm code.