Some comments from the above function are similar, so I won't repeat them here.