Refactored some test code.