More complete "clean up" code.