Could you explain what this function does in a comment?