Really this could do with some tests, otherwise it'd be easy to see the behavior accidentally getting regressed in a future change.