tests and refactoring.