more reorg and fixes; formToDoc and docToForm now receive an expanded doc
more reworking and bug fixes