Thanks @astrofrog, perhaps this diff does not belong to the PR but will leave it here for the moment.