Ainsl tweaks

These are various tweaks to the ainsl script. I have kept them in seven separate commits for clarity-per-commit (better than viewing the entire diff), and for cherrypicking if you prefer, especially because the last two are arguably design-choices rather than "essential fixes". To that end, I have tried to make the first commits the more important (or more obvious) ones.