Added more tests and fixed issues.