Refactor document builders to use less magic.