Improved test - still needs refactoring