Copy script from v0.2.1 back to master