Improved cleanup script.