Thanks for the patch.
Maybe it's better to add some comments here.
LGTM except the nit.