Refactored the use of named objects, reducing duplicate code and complex tests.