changed how the doc structure is read