#15 Fix tests and handle a few more edge cases