Refactored and updated test.