Cleanup and test fixing