Update script to v1.5.1

Squashed a few bugs I saw crop up due to my (failed) experiment with indexOf. D'oh!