Some test code changes and code cleanup.