Now that this functionality is split out it should be easier to test it, so it would be nice to add some test cases for it.