Added more tests, minor fixes