defstruct source-document refactoring