Refactored and revised tests.