Backporting changes to the old script.