Could do with a unit test for this as well.