cleaner factor graph hierarchy, and hacks to make Intellij deal with it.