Would be good to cover this function with a test.