Add more tests and cleanup test code.