Added some more unit tests
Fixed some bugs