refactoring to use 'Doc' structs in place of the Builder style