#4813: Clean up some of the copied code.