Maybe, this part is straight from the original PR.