Lots of minor cleanup changes to fix bugs and work better with h2gb-babel