Add a test and code cleanup.