more work on document generation