Writing a script is hard, I've discovered.