Refactor some functions into ugh.dl.DocStruct class