add missing comments to dmain2.d

and some trivial refactoring. No functional changes.