Accidentally combined these branches. There is another pull request for this stuff.