Added more tests and fixed a few things