Added some more tests and fixed some issues.