changes to make the script easier to fork