Adding more tests, refactoring.