cosmetic changes
fix handling of modified docs having a parent
indent
add debug prerr_endline in comment