Add automatic Document reordering during validation.

Remaining issues: #33