with+script final

Same as https://github.com/enigma-dev/enigma-dev/pull/781, but updated so that it can merge with master, and added some improvements that Josh recommended (the last 2 commits).