Refactored and improved test.