Add more tests, and fixes.