Refactored test code.