Would be great to have the purpose of this function documented in a couple lines of comments.