Adding some more tests, bug fixes, etc.