ENH: Cleaner utils and testing

These changes were in my recently-merged PRs, and somehow got wiped during rebasing (argh).