Would it be possible to write a quick unit test for this function?