Merge cleanup code from Brian N.