This whole file is Joni's patch, which he sent on the mailing list.