More test coverage and refactoring.