Added some more tests and cleanup