Uncommitted changes from going through three laptops. Looks like bugfixes and unit tests.