more refactoring for brandywine. it's getting much better.