Add a bunch of new tests, fix some broken code, update readme.