more work on patch document creation